service service_name start
When i tried running this from cmd line, it works. But when i try to schedule it via cron, i get an error saying
/bin/sh: service: command not found
Why is crontab not working in your system? Crontab might fail for a variety of reasons: The first reason is that your cron daemon might not be working for any reason, resulting in your crontab failing. There also exists a possibility that your system's environment variables are not settled correctly.
It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .
Cron allows Linux and Unix users to run commands or scripts at a given date and time. You can schedule scripts to be executed periodically. Cron is one of the most useful tool in a Linux or UNIX like operating systems. It is usually used for sysadmin jobs such as backups or cleaning /tmp/ directories and more.
sbin
is not in the path when run via cron. Specify the full path to service
. This is probably either /sbin/service
or /usr/sbin/service
. You can find the path on your system by running which service
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With