Stopping cron job


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stopping cron job
# 1  
Old 01-12-2015
Stopping cron job

Hi,

I have scheduled one job in crontab. I want to stop the job automatically after some time of its execution without killing it.

Could i archive the above?
# 2  
Old 01-12-2015
We cant give an appropriate answer knowing nothing about the job...
You are to give us the most information possible including OS OS version, shell etc in order to expect replies in adequation...
# 3  
Old 01-12-2015
On some operating systems you can send a SIGSTOP signal to a process to suspend it, and a SIGCONT signal to have it resume processing. But, if a process was processing network connections when it is suspended, the connections may timeout while it is suspended and might not be recoverable when it resumes.

I don't know what you mean when you say you want to archive a stopped process???
# 4  
Old 01-12-2015
Can you clarify what you mean by "stop the job automatically after some time of its execution without killing it". Can I interpret that as you want to suspend (sleep) the execution of the job under certain conditions? If so, what are those conditions?
# 5  
Old 01-12-2015
Might you even be asking "I want this to run for 3 months and then not after that." or something similar?

If so, you could set yourself an at job to:-
  • Get your cron-table definition
  • Comment out the line you want to suspend
  • Re-submit the for future (non) running

I regret that you have not been clear enough on what you actually want for anyone to be though.


Robin
# 6  
Old 01-12-2015
@rbatte1......AFAIK if you comment out a crontab line directly, depending on the O/S, it might not see that change for up to 24 hrs. That can happen because you by-pass the proper crontab tools for inserting/deleting jobs. To ensure immediate effect the script would need to stop/restart the cron daemon, and to do that, it would need to be running as root.
# 7  
Old 01-12-2015
Quote:
Originally Posted by hicksd8
@rbatte1......AFAIK if you comment out a crontab line directly, depending on the O/S, it might not see that change for up to 24 hrs.
No need to do so directly. The proper crontab tool responds to scripting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

3. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

4. Shell Programming and Scripting

CRON Job

Hi all, Pretty new to CRON but have been messing with Ubuntu for a while now Here is the situation/problem I have run into you. I currently run a very basic back procedure by executing a daily CRON job which copies all data from one directory to a USB drive & date stamps the copy:- cp... (2 Replies)
Discussion started by: 2scoops
2 Replies

5. Shell Programming and Scripting

Stopping Cron Mail to administrator

I have written a number of shell scripts which I have added to cron to run on an Apple Xserve running MAc OS Server 10.4.11. Recently I configured postfix to use one of my company's email servers as a relay so that it can send out statistics about the number of jobs my shell scripts have... (2 Replies)
Discussion started by: buzzs4w
2 Replies

6. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

7. UNIX for Dummies Questions & Answers

CRON usage for CRON job

can anybody explain the usage of CRON for adding a cron job. please provide an example also for better understanding !!! Thanks (1 Reply)
Discussion started by: skyineyes
1 Replies

8. Shell Programming and Scripting

cron job

I believe that crob invokes command under bash. But most of our work are carried out using c shell. So what do I need to be aware of (or what precautions should I be taking) when I use cron. (1 Reply)
Discussion started by: sharanbr
1 Replies

9. UNIX for Advanced & Expert Users

stopping cron temporarly for weekend maintenance

I need to do some DB maintenance, but there are cron jobs running all weekend. How do I stop the cron jobs (that I see when I do a crontab -l) for the weekend then restart the cron jobs. My understanding is that when the system is startted cron jobs in the /usr/spool/cron/crontabs folder are... (2 Replies)
Discussion started by: cjcamaro
2 Replies

10. Shell Programming and Scripting

cron job

how do you schedule a job to run at the last day of the in a single crontab line for example if I put a crontab entry of 0 0 31 * * /path_of_my_script the above will only run if the last day of the months is 31, what happens if the last day of the month is 28 or 30. if I put a crontab... (4 Replies)
Discussion started by: hassan2
4 Replies
Login or Register to Ask a Question