manage cron entry via script - TechRepublic
General discussion
July 31, 2006 at 08:21 AM
support

manage cron entry via script

by support . Updated 19 years, 9 months ago

Hi,

i am building a custom rpm which i also want to do the following:
1. install a crontab entry for 11pm, to run a script daily
2. automatically remove the cron entry when removing the rpm
3. upgrade the cron entry if changed when upgrading the rpm.

I know a bit about shell scripting, but im not too clever with awk,sed and perl which i think is what i will need.

cron.daily or cron.weekly are not suitable because they run early in the morning, not late at night, which is necessary as this script will run backups.

I would use pre and post directives for the rpm spec file.
A sample cron entry would be
“0 23 * * 1-5 /path/to/my/script”

Can someone help with how to automate the addition/deletion/modification of a cron entry, using either awk, sed or perl or equivalent?

TIA,

Les

This discussion is locked

All Comments