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.dailyetc., 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.