I have recently done a migration from on dedicated centos server to another dedicated centos server. There were few backup cron jobs was runing on my old server. I would like to copy them to new server. Could anyone guide me please. using bash is prefereable.


Centos uses cronie, and it reads files/crontabs from the following places:

/etc/cron.d/ # Put any readable file here. Syntax example in /etc/crontab
/etc/cron.daily/ # Any root executable files here. runs daily
/etc/cron.deny # newline separated list of users to deny crontab. 
/etc/cron.hourly/ # Same setup as daily
/etc/cron.monthly/ # same setup as daily
/etc/crontab # Shell variables that all cron jobs source before running.
/etc/cron.weekly/ # same setup as daily 

/var/spool/cron/* # most user defined cron jobs are put here. 

You will have to recreate the cron jobs more or less manually.

  • Copy the relevant crontab entries to the crontab on the new server. I usually just use copy&paste for this with the help of the clipboard of my work machine and two ssh sessions.
  • in case of files in /etc/cron.d or /etc/cron.daily etc., copy the scripts from there to the new server
  • Make sure any scripts, files or other resources you refer to in your current cron jobs are available on the new server. What these resources are is entirely dependent on your local config.
  • if you're giong to copy the files like this, then make sure you restart crond after. – symcbean Jun 12 '12 at 8:47
  • 1
    What? Copypaste? Just copy the user-specific crontabs from /var/spool/cron and all the /etc/cron* stuff, and you are all set. – Janne Pikkarainen Jun 12 '12 at 11:45
  • @JannePikkarainen: Yes, that works as well. Anyway, I like my method and I am usually faster this way. – Sven Jun 12 '12 at 12:04
  • 1
    @SwenW: Faster than scp/rsync? Impressive :) – Janne Pikkarainen Jun 12 '12 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.