Can we schedule a script to run in a particular time period?

sruthi22
Tera Contributor

Hi All,

 

I have a fix script and the requirement is to run it off business hours for around 10 days. May I know if there is a way I can schedule the fix script to run at a specific time period only (eg: everyday between 8PM to 6AM)?

 

Thanks and Regards,

Sruthi.

3 REPLIES 3

Mark Manders
Mega Patron

You can create a scheduled script from your fix script (nothing more than copy the script into the script section of a scheduled job (script execution). You can than schedule it to run daily at any given time.

Depending on your script: if it's runs longer than 10 hours (it will be canceled, but just to inform you): you can't stop the job from running it it's after 6AM. So just let it start daily at 8PM and it won't be an issue.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi Mark,

 

Thanks for the response. Is my understanding correct that a scheduled job would stop its execution automatically after every 10 hours?

 

Also, if that is the case, could you please tell me after how much time does a fix script stop automatically?

Thanks and Regards,

Sruthi.

No. There are properties that will kill a job if it runs too long. So if you are planning on running a job that really takes this long, be advised that that will be killed by ServiceNow. I don't know your requirement, but you can't run a script between two timestamps and have it pick up where it left of at the next timestamp.

What is your fix script supposed to do that you expect it to run this long? It would be best to take a different approach.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark