Import – Export crontab

One way is to work on the crontab file in another existing directory (e.g. /home/myuser/crontabs).
For example (for root crontab).
cd /home/myuser/crontabs
cp /usr/spool/cron/crontabs/root root
cp /usr/spool/cron/crontabs/root root.270309
Then you can use vi to edit the file called root. Within vi the “:r filename” function is the easy way to import a block of lines from a file called filename).
After reviewing your new crontab, submit it with “crontab root”.
Using this method if you find that you have made an editing error, you still have a copy of the original crontab.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.