Tag Info

Hot answers tagged

2

First of all: you should investigate the "real" problem with supervisord instead of restarting the service every night. That being said, try to use /etc/init.d/supervisor stop / start or restart. Many times cron has problems using service. You also have to create the cron as the user supervisord runs on, or as root via sudo crontab -e. Also always use ...


2

Assuming your service has a status command, you can do something as simple as in the cron job: 0 0,12 * * * service whatever status >/dev/null || service whatever restart That way, you first run the status check, discard verbose output, and then verify that exit code is not 0 (which would be good), in which case - restart. Indeed, with a ...


1

Cron does not execute processes in a login shell. Because of this, all the typical scripts are not sourced when a process is executed. Executing the process from within a login shell should replicate the user's environment. Put something like this in a crontab and compare the two outputs: */1 * * * * /usr/bin/env > /tmp/env ...


1

Regarding the question - why is this so - the manual page that explains it is crontab(5), IOW the one accessible through man 5 crontab (not the default one in section 1). The cron daemon does not try to emulate a shell session, rather it sets up a clean, minimal environment for the cron jobs to run in, and then in turn allows the crontab file to set its own ...


1

It should finish, it can take some time especially if you didn't run it in a while. But generally it will finish. If it doesn't you'll need to check what is going on. Yes, that is how this is generally done, see: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job


1

can you run crond with -x for debugging and see if it helps? I've tried running the same job with same crond option and it works fine for me. I'm using Centos7. Also have you tried using "hello".


1

Found it. The version that is in centos 6 has a bug that was fixed 4 years ago but hasn't been backported by Redhat. https://www.fedorahosted.org/cronie/ticket/8 Going to build my own revision.


1

Solution: Instead of running 'service httpd status' run '/etc/init.d/httpd status This has worked flawlessly. What keyed me onto this was attempting to run this in Ubuntu 14.04.2 LTS, I looked at the cron log for errors, found the errors online and substituted the above.


1

You need to escape special characters with backslash so try with + and \%. And, also other special characters too (if any). The other option is to put these long commands in simple shell script, add executable permission bit to those scripts and reference them in your crontab.



Only top voted, non community-wiki answers of a minimum length are eligible