I created a script that will add a cron job based on user specifications but it won't work since I need to refresh cron every time I append a job in crontab. Is there a way to refresh cron without killing the process?
As long as your script uses
crontab to add and delete job specifications for the user, there would be no need to restart the
The AIX 7.1 cron manual page says:
When you make changes to the crontab files using the
crontabcommand, a message indicating the change is sent to the cron daemon.
See also the
The general flow of actions that your script would take:
- Get user's crontab into a text file using
crontab -l >crontab.txt.
- Manipulate the text file by adding, removing or changing jobs specifications.
- Load the user's crontab with the new specifications using
The commands in the first and last steps needs to be executed as the user (the first step could also be run as
crontab -l username >crontab.txt as e.g. root).
This would work on any Unix using
AIX 7.1 cron manual page says:
The cron daemon reads the configuration file when it is activated and when it receives the hangup signal.
kill -HUP cron_pid should do it.