Operating System - HP-UX
1854820 Members
22961 Online
104103 Solutions
New Discussion

Re: resubmitting cron jobs

 
SOLVED
Go to solution
Shivkumar
Super Advisor

resubmitting cron jobs

Dear Sir,

We have a script say abc.sh running through cron job. We just wanted to delete couple of lines.

How to implemented this ? Do we need to re-submit the cron job ?

Thanks,
Shiv

10 REPLIES 10
Warren_9
Honored Contributor

Re: resubmitting cron jobs

hi,

change of the abc.sh DO NOT need to re-submit the job.

GOOD LUCK!
Adisuria Wangsadinata_1
Honored Contributor

Re: resubmitting cron jobs

Hi,

You dont need to re-submit the cronjob, but if you want to make sure just do this to restart the cronjob :

# /sbin/init.d/cron stop
# /sbin/init.d/cron start

Hope this help you.

Cheers,
AW
now working, next not working ... that's unix
Kevin Wright
Honored Contributor

Re: resubmitting cron jobs

no need to do anything.
Devender Khatana
Honored Contributor

Re: resubmitting cron jobs

Hi,

You can change the file which is called through that cron job. The file is read and executed everytime that job is run and is not kept in buffer. So doing the chages to the file itself shall be enough. Allthough monitor it once after changes for proper execution.

HTH,
Devender
Impossible itself mentions "I m possible"
Eknath
Trusted Contributor

Re: resubmitting cron jobs

Hi Shiv,

Just modify the script, you need not resubmit. System will execute from its location it does not make a copy anywhere...

Cheers!!!
eknath
Cem Tugrul
Esteemed Contributor

Re: resubmitting cron jobs

Hi Shiv,

you do not need to re-submit the cron for
your script so just modify your script

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Himanshu_3
Valued Contributor

Re: resubmitting cron jobs

Hi Shiv,

If you see the crontab -l you would see the the time and other day parameters when this script of your is executed. You can change the timings of your script file by modifying the schedule by crontab -e command. the format in the crontab reads somehting like this

# 00 00 * * * /usr/local/scripts/cronscript
# | | | | | |
# | | | | | script to run
# | | | | +---------- month
# | | | +------------ day
# | | +-------------- day of the week 0-6, 0 = sunday, 1-5 = mon to fri
# | +----------------- hour of the day 00 to 23
# +-------------------- minute 00 to 59


As soon as you modify the cron file, the script would be executed on the next execution time. It would be picked from the same location as it was mentioned in the crontab.
Rgds,
Himanshu
Yogeeraj_1
Honored Contributor
Solution

Re: resubmitting cron jobs

hi,

the cron job will execute as abc.sh

you can thus change the abc.sh independently.

so no need to modify the crontable.

You may wish to view the content of the crontab using command: crontab -l

If you want to change the scheduling in the crontab, it is better that you first save the content to a file using: crontab -l > crontab.txt

then, edit the file:
vi crontab.txt

and finally load the file to activate the changes:
crontab crontab.txt


if you are not at ease with this, use SAM!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Venkatesh_18
New Member

Re: resubmitting cron jobs

Hi,

You can implement using different approach.

Solution 1. Edit the cron entries by invoking this command "contab -e". This will open the crontab temp file. Modify the content and save the file. When the next time cron runs changes will takes place.

Solution 2. Modify the contents in cron script file "abc.sh". Remove the cron entries by exectuing "crontab -r". Then execute "crontab abc.sh". Now the changes will takes place.


--Venkatesh
Muthukumar_5
Honored Contributor

Re: resubmitting cron jobs

You need not. Because cron will execute the code available in abc.sh at the time of execution. Anyway, If you change code of abc.sh during abc.sh execution, changes will not be in effect.

Cron is just like automating execution of scripts based in time and date. It will store script contents at all. ;)

hth.
Easy to suggest when don't know about the problem!