0

We have two Linux servers running with the same application and infrastructure/middleware setup (test and production), I want to run a health check program as a cron job every 2 minutes on server A like it already dose on server B.

What did I copy is the script from the sever B, implemented the script in the same directory in server A and added the job to Cron using crontab -e:

*/2 * * * * /opt/xxxx.sh arg1 arg2 >> test.txt 2>>err.txt

The output commands are just to see if the cron kicks the job.

The line which I added on crontab runs as expected individually on command line but it doesn’t execute as a cron job. When I added another job to cron (echo >> test.txt kind of thing), then it worked just fine.

  • I changed the permission of the script to 755,
  • When I exit the crontab editor it confirms the new installation.
  • I have tried rebooting the server several times.

What do you think can I do more to make the health check run as a cron job?

There’s no output in /var/log/cron.

—————————————————

Dear Martin Wood Thank you. The program is written in Java but then it’s the shell script that runs the health check. I get no output by running: run-parts /etc/cron.hourly -v —————————————————

  • Are you getting any output (errors, warnings) in any of the log files? – Kusalananda May 20 '18 at 17:33
0

Does the script rely on dependencies such as Python or Ruby? Those will need permissions as well. You can test this with:

 run-parts /etc/cron.hourly -v

and see if it encounters any errors. Run as root as this is the uid cron runs with.

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.