LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-01-2011, 11:21 AM   #1
Shodan30
LQ Newbie
 
Registered: Dec 2010
Posts: 10

Rep: Reputation: 0
Crontab updating without -e


Hello,

I'm trying to evoke a crontab change automatically as part of an update. I'm using SuseLinux and I think i can just replace the /var/spool/cron/tab/scs file but all the cron manual pages say not to do that, also im unsure if changing this file by copying over it will immediately accept the changes since I'm not specifically telling it that I've edited it. Is there a way to refresh the crontab once its been replaced without actually -e editing it manually?

Thanks
 
Old 08-01-2011, 11:28 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You might save the output of crontab -l to a file, e.g.
Code:
crontab -l > /tmp/my_crontab
then edit the file using sed or some other tool at your choice, then reinstall the crontab from the file using:
Code:
crontab /tmp/my_crontab
You may want to remove the initial commented lines added to the crontab -l output in OpenSuSE. To do this on-the-fly you can use process substitution:
Code:
crontab <(sed '/^#/d' /tmp/my_crontab)

Last edited by colucix; 08-01-2011 at 11:29 AM.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating 'some' crontab's .... mfons Linux - Server 3 09-02-2009 06:46 AM
linux crontab vs unix crontab ytd Linux - General 2 08-09-2009 05:07 AM
replaced crontab, now should get crontab back to what it was raminn Linux - Newbie 2 10-20-2008 07:15 PM
man crontab(5) vs crontab(1) Canis Polaris Linux - Newbie 2 06-04-2008 04:03 PM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration