How to move crontab from one server to another?

I have a list of crontab jobs, I would like to move them without re-typing .. How can we do that is there any command?
LVL 5
CalmSoulAsked:
Who is Participating?
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Open PuTTY to both servers, do crontab -l on one and crontab -e on the other. Copy lines from one to the other, do this for each cron user.
0
 
Shiju JacobInfo SecurityCommented:
do crontab -l on the source server and copy to destination server /etc/crontab file and save it
0
 
Jeffrey Dake Senior Director of TechnologyCommented:
I would just scp the file from one server to the other.

http://en.m.wikipedia.org/wiki/Secure_copy
0
 
TintinCommented:
Depends where the cronjobs are defined.

If they are in /etc/cron.daily /etc/cron.weekly or /etc/cron.monthly, then just scp the files in those directories to the new server.

Otherwise, do

crontab -l >/tmp/cronjobs
scp cronjobs user@newserver
ssh newserver "crontab /tmp/cronjobs"
0
 
SandyCommented:
cron jobs are stored in /var/spool/cron/<user_name> and if you perform #scp from one to another system it will work

TY/SA
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.