473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

mysql cron job restart thingy

RedSon
5,000 Expert 4TB
Hi guys,

I don't really know anything about cron jobs but I need something that will check to make sure my mysql server is up and running every few minutes or so. Or maybe one that can detect if the mysql process died and restart it. I also need to make sure that it is set to come on line after a reboot.

I'm running Ubuntu Feisty. Mysql Ver 14.12 Distrib 5.0.38.

Thanks!
Jun 15 '07 #1
7 4983
arne
315 Expert 100+
Hi guys,

I don't really know anything about cron jobs but I need something that will check to make sure my mysql server is up and running every few minutes or so. Or maybe one that can detect if the mysql process died and restart it. I also need to make sure that it is set to come on line after a reboot.

I'm running Ubuntu Feisty. Mysql Ver 14.12 Distrib 5.0.38.

Thanks!
RedSon,

I don't really know anything about mysql :-), but I guess that there's an init script to start the server. Have a look in /etc/init.d/. These init scripts usually take the standard arguments (start, stop, restart and status). You could write a script, which is checking the status (/etc/init.d/mysqld status) and depending on the result start the daemon (/etc/init.d/mysqld start). For this script you could then make an crontab entry.

BTW, the init script is typically also used to start your service at boot time. Depending on the runlevel into which you're booting your system, the corresponding services are started.

HTH,
arne
Jun 15 '07 #2
RedSon
5,000 Expert 4TB
RedSon,

I don't really know anything about mysql :-), but I guess that there's an init script to start the server. Have a look in /etc/init.d/. These init scripts usually take the standard arguments (start, stop, restart and status). You could write a script, which is checking the status (/etc/init.d/mysqld status) and depending on the result start the daemon (/etc/init.d/mysqld start). For this script you could then make an crontab entry.

BTW, the init script is typically also used to start your service at boot time. Depending on the runlevel into which you're booting your system, the corresponding services are started.

HTH,
arne
When mysql is not running I do that.

/etc/init.d/mysql restart

And everything runs fine. But I want something that automates that. I don't know how to do bash scripting or cron stuff, so if someone wouldn't mind giving me the simple form of the script or send me a link of something similar to tutor myself with I would appreciate it.

Gracias!!!
Jun 15 '07 #3
arne
315 Expert 100+
When mysql is not running I do that.

/etc/init.d/mysql restart

And everything runs fine. But I want something that automates that. I don't know how to do bash scripting or cron stuff, so if someone wouldn't mind giving me the simple form of the script or send me a link of something similar to tutor myself with I would appreciate it.

Gracias!!!
An even simpler (and better) solution (no additional scripts, no cronjob) would be to create an entry in /etc/inittab. Try 'man inittab' and look for the 'respawn' option.

arne
Jun 16 '07 #4
RedSon
5,000 Expert 4TB
An even simpler (and better) solution (no additional scripts, no cronjob) would be to create an entry in /etc/inittab. Try 'man inittab' and look for the 'respawn' option.

arne
there is no manual entry for inittab but I will look online to see what I can find. Thanks for the tip!
Jun 18 '07 #5
arne
315 Expert 100+
there is no manual entry for inittab but I will look online to see what I can find. Thanks for the tip!
Yes, should be easy to find, here's one example: man inittab

arne
Jun 19 '07 #6
Motoma
3,237 Expert 2GB
Hi guys,

I don't really know anything about cron jobs but I need something that will check to make sure my mysql server is up and running every few minutes or so. Or maybe one that can detect if the mysql process died and restart it. I also need to make sure that it is set to come on line after a reboot.

I'm running Ubuntu Feisty. Mysql Ver 14.12 Distrib 5.0.38.

Thanks!
Is MySQL just dying? I think the best solution would be to determine what is causing it to do so.
Jun 19 '07 #7
RedSon
5,000 Expert 4TB
Turns out ubuntu uses a thing called upstart which is a bunch of scripts in etc/event.d. It is a pretty interesting replacement for inittab plus it is perfectly compatible with inittab scripts.
Jun 19 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Neil | last post by:
Hi, I hope this question isn't too far off topic....I'm almost at my wits end trying to figure this out. I have a Mysql database and I wish to automate the backup of the database because I...
0
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
3
by: the.natalie | last post by:
Hi. I am a newbie to mysql, cron, and shell scripting, so please bear with me. I have a script that is used for updating an image directory based on contents in a database. The script does the...
4
by: Richard | last post by:
Hi All, I've been trying to build a Ruby-on-Rails plus MySQL application. I'm running Ruby 1.8.2, Rails 1.1.4 and MySQL 5.0.15-nt over WinXP-Pro/SP2. I run under an Administrative account. ...
3
by: dburdick | last post by:
I was referred to this forum as this may be a php specific problem. Some kind of configuration problem maybe. I have some php files that connect to a mysql database and are run as cron jobs. ...
0
by: Pratchaya | last post by:
In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log long_query_time=1 #######
4
by: martinf | last post by:
Hello group, I've inherited a box running FC6. The website I'm trying to copy across to it ran fine on FC5.. PHP & MySQL were set up 'out-the-box' so the site just worked. Somethings...
2
by: mezise | last post by:
Posted by Pratchaya: ------------------------------------------------------ MySQL Slow Log ERROR In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log
1
by: symbioid | last post by:
Hello, I'm working on a project, and VMware has problems with suspending the virtual machine. We are accessing the machine through samba. However, when I suspend the VM, it stops the Samba...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.