How to quickly disable a single job in crontab [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I need to quickly and temporarily disable a particular job in crontab under linux. How can I do that?

The quickest way would be to edit the crontab file (which can be done by typing crontab -e) and simply comment the job you want disabled. Comment lines in crontab start with a #.
0 0 1 * * this_job_i_want.sh
# uncomment below to enable
# 0 0 2 * * this_job_i_dont_want.sh

Simply edit your cron time to run every February 30. ;)
* * 30 2 * this_job_will_never_run.sh
This is especially helpful for those using a GUI to manage their cronjobs (i.e. cPanel, Plesk, etc.) and don't have access to the actual cron file.

Related

Run cron every nth second of every minute? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
What would be the cron expression for "nth second of every minute"?
For example, for every 5th second of every minute, the cron would run at 1:00:05, 1:01:05, 1:02:05 and so on.. 24x7.
I could not find any documentation for achieving this.
Thanks in advance!
This functionality is not available out of the box. What you could do is prepend your command with sleep, so it would be:
sleep 5 && /app/script.sh
Figured it out. The cron expression would be.
5 * 0 ? * *

cron every hour between 6 am to 18:00 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I don't have a box to test a cron job so I am posting it here.
I want to run a job every hour between 6 am to 18:00.This is what I have tried
0 6-18/1 * * * <command>
and
0 6-18 * * * <command>
Which one is the correct way of achieving it
Both should work, but I would probably use the second one.

Crontab every five minutes [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to set up a crontab in linux that runs every 5 minutes
I need to run the following command:
/var/local/orders/ pmtw-print.jar localhost pmtw root itsm
This is what I think I should have but doesn't appear to be working:
5 * * * * java -jar ~/var/local/orders/ pmtw-print.jar localhost pmtw root itsm
Thanks
To run every 5 minutes, use the following. The one you have would run at 5th minute every hour.
*/5 * * * * java -jar ~/var/local/orders/ pmtw-print.jar localhost pmtw root itsm

How to run cron job periodically within time range on linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I would like a cronjob that runs every 5min with the condition that it doesn't start at time 0.
Current schedule is:
*/5 * * * *
However, this will kick off the script at 00:00. I need something like (5-60)/5 * * * *
Thanks!
I'm not sure there is a way to do this in cron. You might be better off leaving the schedule as is, and checking the time in the beginning of your script, and using a condition to exit the script if it is not supposed to run at that time.

how to set crontab every 10 minutes delete content of log file on linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I wanna delete content of log file (/var/log/httpd/access_log) every 10 minutes, Please show me how to do that with crontab in linux
Help me please
Thanks a lot
Open root's crontab for editing in default editor:
sudo crontab -e
Then add this line:
*/10 * * * * echo '' > /var/log/httpd/access_log

Resources