Restarting cron after changing crontab file?
No.
From the cron man page:
...cron will then examine the modification time on all crontabs
and reload those which have changed. Thus cron need not be restarted
whenever a crontab file is modified
But if you just want to make sure its done anyway,
sudo service cron reload
or
/etc/init.d/cron reload
Cron needs restart in order to process modified /etc/crontab
I'm not crazy. Suse have identified it as a regression which will be fixed shortly.
Restarting cron after changing crontab file?
No.
From the cron man page:
...cron will then examine the modification time on all crontabs
and reload those which have changed. Thus cron need not be restarted
whenever a crontab file is modified
But if you just want to make sure its done anyway,
sudo service cron reload
or
/etc/init.d/cron reload
Setting up a new Cron to run a PHP file and nothing seems to happen
Check the path to index.php file is correct or not. Also run crontab -l command to see the list of crons.
service restart doesn't happen when using cron
This might have been a path related problem I was able to make it work as expected by providing the full path to service
.
#!/bin/bash
python /home/ubuntu/gateway-haproxy-config.py | tee /etc/haproxy/haproxy.cfg.new
DIFF=$(diff /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.new)
if [ "$DIFF" != "" ]
then
mv /etc/haproxy/haproxy.cfg.new /etc/haproxy/haproxy.cfg
/usr/sbin/service haproxy restart
else
echo "unmodified"
fi
Edit crontab programmatically and force the daemon to refresh
Thank you very much gnibbler and Aaron. I just went through the source code for both 'whenever' and 'cronedit' gems for Ruby. Both of them does a 'crontab -' which replaces the existing cron file with the updated cron entries. That means contrary to my original question, these libraries make use of the standard crontab tool which in turn would do whatever specifics necessary to refresh the daemon.
I think the best platform-independent, and cron (dillon, vixie, mcron etc.) agnostic way to refresh the daemon is to always use the associated crontab utility. Even when editing programmatically, the user-program must pass the new cron file to the crontab utility which would do whatever is required by that specific platform/cron.
@Mark, thank you for the comments. However, I'm trying to provide a simple web frontend that the user can customize through the www just like editing the crontab file directly.
Thank you so much for your responses!
Related Topics
How Would One Disable Nagle's Algorithm in Linux
How to Avoid Transparent_Hugepage/Defrag Warning from Mongodb
How to Check If Sed Has Changed a File
Linux Removing Folders Older Than 1 Year and More Than 3 Files
Converting Serial Port Data to Tcp/Ip in a Linux Environment
Redirecting Stdout with Find -Exec and Without Creating New Shell
Delete All Files Older Than 30 Days, Based on File Name as Date
In Bash, How to Add a String After Each Line in a File
How to Get the Difference (Only Additions) Between Two Files in Linux
Relinking an Anonymous (Unlinked But Open) File
Secure Way to Run Other People Code (Sandbox) on My Server
Bash Command Substitution on Remote Host
How to Use Gdb to Debug a Running Process
How to Program Linux .Dts Device Tree Files