UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 13th, 2012, 07:04 PM
TiggerForASL TiggerForASL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 15 TiggerForASL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 10 m 18 sec
Reputation Power: 0
Replicating a crontab from one UNIX system to another one

What is the most efficient and easy way to create a crontab from another one, on a UNIX platform (no Windows machines involved)?

I want to replicate an existing crontab from a test system and copy it over to the development system.

I am using "crontab -e" on both systems in a vi environment. Currently I am copying and pasting one line at a time, minus the last character of the line and typing that. If the line is so long that it wraps around to another line, then I am typing the last bit of the line and the first bit of the next line, then copying and pasting the rest of the line minus the last character and typing that.

Why, you might ask? Well, I seem to get syntax errors otherwise and I do not know if I have any kind of debugging tool. However, this is not a short file.

I get a syntax error trying to copy and paste within the test file itself, so it's not a question of the difference between the systems, just simply when trying to save the file. My UNIX book did not even mention using ZZ to save the file. I do have access to Safari Online at work.

Suggestions?

Reply With Quote
  #2  
Old February 14th, 2012, 03:54 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 40 m 59 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
So you just need to copy the file? Try something like SCP. Worst case, grab a USB drive and manually copy the file that way.

Reply With Quote
  #3  
Old February 14th, 2012, 08:19 AM
TiggerForASL TiggerForASL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 15 TiggerForASL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 10 m 18 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
So you just need to copy the file? Try something like SCP. Worst case, grab a USB drive and manually copy the file that way.


What is SCP? I do not even know where the file is located. I use the "crontab -e" command and there it is. I use :w! then the filename I used for a backup of the information to write the information to a file for safekeeping.

Someone mentioned looking at /var/cron, so I will try looking there.

Also, someone mentioned the following command to edit out what may be the problem with line feed characters:
:1,$s/^V^M//g

They called the caret the control key at one point and an escape character at another point. I believe they meant to literally type the above command. However, I saw no ^M at the end of the lines after copying and pasting.

Reply With Quote
  #4  
Old February 14th, 2012, 09:18 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 40 m 59 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
- I don't know what ^V is, but ^M is a line ending character. If you were seeing it then that would mean the file has Windows-style line endings (which would be weird for the crontab file).

- crontab -e edits the crontab file. It's generally in /etc but could be somewhere else. That's what you'd want to copy. Your distro might have other crontab locations, like /etc/cron.daily or cron.monthly; you might want those too.

- SCP lets you copy files across systems when you have SSH access to both. Google it.

Reply With Quote
  #5  
Old February 14th, 2012, 02:40 PM
TiggerForASL TiggerForASL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 15 TiggerForASL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 10 m 18 sec
Reputation Power: 0
I do not see any ^V or ^M when using "crontab -e".

I can look in those locations for the saved file.

Reply With Quote
  #6  
Old February 15th, 2012, 09:35 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,107 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 3 h 57 m 31 sec
Reputation Power: 1485
There is alos the option of using crontab -l to list the cronfile, and redirecting the output to a file which you could copy across if you are not sure where the cronfiles exits. A man crontab should tell you the location of the files.
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #7  
Old February 15th, 2012, 09:45 AM
LKBrwn_DBA's Avatar
LKBrwn_DBA LKBrwn_DBA is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2006
Posts: 748 LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level)LKBrwn_DBA User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 1 h 41 m 3 sec
Reputation Power: 348
Follow SimonJM instructions:
Code:
crontab -l >cron.txt
scp cron.txt otherHost:/`pwd`

## login to otherHost
ssh otherHost
crontab -e <cron.txt

Good luck!
__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Replicating a crontab from one UNIX system to another one

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap