Solved

How can I copy a cron file from one machine to another machine?

Posted on 2011-09-28
7
747 Views
Last Modified: 2012-05-12
Hi,
I have two Unix machine. I want to copy (rsync) the cron file from one machine to another.  

How can I do that?

and

Is it secure to do it?

Thanks,
0
Comment
Question by:Tolgar
  • 4
  • 3
7 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 36718513
crontab -l > tempfile

(rsync tempfile to other system)

On other system:

crontab tempfile

Take care to log in as the crontab owner on both systems!

wmp

0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718535
Just copy the contents of the crontab file from one server to another.  It is usually located under /var/spool/crontabs.
0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718546
sorry I misread the question; listen to wool
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36718550
And how should cron recognize that there's a new crontab now?
0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718582
Depending on your flavor of Linux/Unix it should check in every so often but you could use

crontab -e

or

/etc/init.d/crontab stop && /etc/init.d/crontab start
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36718611
So if you must issue a command like crontab on the target system anyway - why not use it on both ends?

It's consistent and compatible with almost all Unix flavors (well not with ESX(i) but that's another question).

wmp
0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718679
I'm not sure why you are trying to argue with me but if you read above I said I misread the question and to ignore my response.  Please help the person asking the question instead.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now