mardi 22 mars 2016

Why is crontab executing on one server but not the other?

I have two servers on linode that have some websites on them. I created a script to see if mysql is running on the server and if it's not running then the script will start mysql. The script is on both servers and in the same file structure.

I have added the script to cron using the "crontab -e" command with both servers. The problem is my dev server will run the script while the prod server will stay down. I have added spaces to the end of the crontab so I know that isn't the problem.

When the script is run manually on the prod server I get this error "(No info could be read for "-p": geteuid()=1000 but you should be root.)". Even though the error shows up the script still restarts mysql but when the script is executing with cron, mysql will not restart. Also note that I have run the script on the dev server and managed to get the same error. Even though the error is there, the script will run on dev and restart mysql when run through cron.

When I run a command under sudo on the dev server it doesn't ask for the pass but when I run it on the prod server I get asked for a password.

I have checked syslog so I know that the cron command is running.

The script uses the netstat command with the parameters -v -u -l -n -t -p.

Why is crontab executing on one server but not the other?

Aucun commentaire:

Enregistrer un commentaire