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?
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
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?
That is one way, another is running crontab -e
Thanks cpradio for the confirmation!
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.
Thank you so much. found some good information there!!
This topic is now closed. New replies are no longer allowed.