Exporting and importing CRON jobs
To export or import CRON jobs you have to connect to the server via SSH.
To export list of CRON jobs to the file with custom name execute following command:
crontab -l > <filename>
Example of exporting the list to the file /root/exported-cron:
crontab -l > /root/exported-cron
Importing the list of the CRON jobs will replace current CRON jobs.
To import list of CRON jobs from the file execute following command:
crontab <filename>
Example of importing the list from the file /root/exported-cron:
crontab /root/exported-cron
If it is required to add the list of CRON jobs from the file, you can merge lists before importing. To do this, execute following command:
- Export list of current CRON jobs to the file:
crontab -l > /root/current-cron - Merge list of current jobs and list of exported jobs using cat:
cat current-cron exported-cron > merged-cron - Import list of CRON jobs from merged file:
crontab merged-cron