Why isn't cron running my script?
- by Jingqiang Zhang
Now I want to use Backup and Whenever gem to automatic backup my database.
When I connect the server by ssh as an added user to run backup perform -t my_backup,it works well.But the cron file:
0 22 * * * /bin/bash -l -c 'backup perform -t my_backup'
can't run at 22:00.
When I use cat /etc/crontab check the cron's config file,it is:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
The /bin/bash and /bin/sh are different.What's the reason?How to do?