Date: Sat, 17 Dec 2005 14:13:04 -0500 From: Gerard Seibert <gerard@seibercom.net> To: freebsd-questions@freebsd.org Subject: Script Problem Message-ID: <20051217141021.1B66.GERARD@seibercom.net>
next in thread | raw e-mail | index | archive | help
Using FreeBSD 5.4 Please do not laugh. I absolutely suck at writing scripts. Someday I might learn, but in the mean time, I need some assistance. I want to run a script from CRON that will check to see if MySQL is running, and if not, restart it. I have had a problem with MySQL shutting down unexpectedly. This is my first attempt at writing the script. #!/bin/sh if (`ps -wxuU mysql | grep -o mysqld_safe`) then echo "MySQL is Running" else /usr/local/etc/rc.d/mysql-server.sh restart echo "MySql Server is Restarted" fi That produces this output even though MySQL is running. A mysqld process already exists Stopping mysql. Waiting for PIDS: 47567, 47567. Starting mysql. MySql Server is Restarted If I stop MySQL and then run the script, I get this output. mysql not running? (check /var/db/mysql/seibercom.net.pid). Starting mysql. MySql Server is Restarted Obviously, I do not know what I am doing. Perhaps someone could help me with this. Ciao -- Gerard Seibert gerard@seibercom.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051217141021.1B66.GERARD>