afridy — 2013-03-15T05:20:46-04:00 — #1
i created a file contain a cron job at /rename.cron
then i executed the following in the shell > crontab /rename.cron
now this has overwritten the existing crontab contents.
how do i append a cron to crontab without replacing exisiting contents?
eastcoast — 2013-03-15T08:42:07-04:00 — #2
You need to open the existing cron file, read the contents and then append
crontab -l list the existing cron entries, so something along the lines of (untested, so save your existing entries first!)
crontab -l > somefilename; echo 'newcroncommandlinehere' >> somefilename; crontab somefilename
afridy — 2013-03-15T09:07:29-04:00 — #3
Thanks East for the lesson.
i did something like this already.
and just appended the cron job to the bottom of the file.
is this method also accptable?
cpradio — 2013-03-15T09:49:44-04:00 — #4
That is one way, another is running crontab -e
afridy — 2013-03-15T09:55:54-04:00 — #5
Thanks cpradio for the confirmation!
cpradio — 2013-03-15T10:10:22-04:00 — #6
Just an FYI, there are reasons why you should use crontab -e instead of manually editing the file directly. There may be other reasons too, so be weary, what you did worked, but it isn't the ideal way of handling the situation.
I still had an uneasy feeling about the process you took, so did a bit more searching to see if there was a reason NOT to do it that way. Didn't expect to find anything, but the above URL seems to be useful.
afridy — 2013-03-15T10:57:36-04:00 — #7
Thank you so much. found some good information there!!