LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-07-2008, 08:11 AM   #1
TalkingMarble
Member
 
Registered: May 2008
Location: Deventer, The Netherlands
Distribution: CentOS 5.0
Posts: 50

Rep: Reputation: 17
Disable crontab task


Hello,

I have a scheduled task in crontab which i want to prevent from executing for a few days. Is it possible to disable the task in crontab so i can enable the task again when i want to execute it, or can this only be done by completely removing the entry from the task in crontab or by editing the time.

TIA

Last edited by TalkingMarble; 08-07-2008 at 08:18 AM.
 
Old 08-07-2008, 08:17 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Edit the crontab to add/change the day of month you want execution to run. When that day arrives, edit it back to it's current setting.
 
Old 08-07-2008, 08:38 AM   #3
TalkingMarble
Member
 
Registered: May 2008
Location: Deventer, The Netherlands
Distribution: CentOS 5.0
Posts: 50

Original Poster
Rep: Reputation: 17
Is it not possible to disable a task as can be done with a scheduled task in "Windows".
 
Old 08-07-2008, 08:48 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
You can comment it out in your crontab?
 
Old 08-07-2008, 10:10 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
I agree, you can comment it out. If for some reason it does not work, you can always save the crontab to a file, remove it completely and restore later passing the name of the file as argument:
Code:
crontab -l > $HOME/crontab_file
crontab -r
crontab $HOME/crontab_file
but sincerely I don't see any reason for which the comment should not work. Sorry for the superfluous post.
 
Old 08-07-2008, 10:15 AM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,477

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
All you have to do is
Code:
log in as the owner of the cron job or as root or su or sudo
crontab -e
insert # at the beginning of the line you want to stop for a while
save and exit
When you're ready to restart that particular job, just do the above and remove the # (you don't have to do anything else).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Task bar no longer shows task Richard Rahl Linux - Newbie 3 04-12-2010 10:39 AM
Disable right click on task bar Mr.J Ubuntu 1 07-06-2008 05:28 AM
deleting a task from crontab list. jdeeptir Linux - Newbie 1 06-12-2008 11:58 AM
dbx command for corrosponding commands disable or disable on gdb bshankha AIX 0 09-26-2006 10:38 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 01:35 PM


All times are GMT -5. The time now is 04:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration