0

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.

  • This is an aside, but when you have the time, it'd be a good idea to look into some form of process supervision tool instead of cobbling together something with cron. – Xiong Chiamiov Mar 28 '16 at 19:26
0

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

Have you compared sudo config on both nodes? Please run on both machines this command (from the account where you have modified crontab):

sudo -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.