Vanilla List Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Elegant solution?



Beside writing something in perl, awk, etc. Are there any existing tools for
adding and then removing sections within a file?

For instance, Here is the user games:

<snip>
# The time and date fields are:
#
#  field          allowed values
#  -----          --------------
#  minute         0-59
#  hour           0-23
#  day of month   0-31
#  month          0-12
#  day of week    0-7 (0 or 7 is Sun, or use names)

00 * * * /path/updatedb
15 03 * * * /path/backup

<snip>

And I want to add the following to his crontab:

# netrek: Grab the keys every hour at the top of the hour
00 * * * /usr/games/netrek/tools/updatekeys

I could just append it raw to the crontab like this:

cat netrek.cron >> /var/spool/cron/games

But I'd like to use the  crontab program if possible. Any elegant ideas on how
to do this? I have a solution, but it look kludgey to me.

Now the stickler. How to remove just the 
"00 * * * /usr/games/netrek/tools/updatekeys" from games' cron without
destroying the other entries, again using crontab program.

I have a solution, but it is kludgey.

Last question.  Is it wise not to edit the crontab files directly correct? Or
should I always use the crontab program?

-- 
Bob Tanner <tanner@real-time.com>       | Phone : (612)943-8700
http://www.real-time.com                | Fax   : (612)943-8500
Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9