Sanjay Yadav
Sanjay Yadav

Reputation: 799

How to write a scheduler in python to execute a python script at any specific point of time?

I am running two python scripts -

  1. test.py
  2. test1.py

Using a bash script - run.sh- python test.py python test1.py

which is running after every 2 hours. I want to kill this running bash script at a point of time and wanted to restart the same process.

Upvotes: 0

Views: 595

Answers (1)

Miller
Miller

Reputation: 305

Crontab are very useful for routine tasks like scheduling system scanning, daily backups etc. Crontab executes jobs automatically in back end on specified time interval. For scheduling one time tasks you can use Linux at command

  • Schedule a cron to execute on every two hours. If you want to run script on 4 hours interval. It can be configure like below.

0 */2 * * * /scripts/script.sh

by using corn you can do a lot try this link its provide a grate support about corn schedule .

Upvotes: 1

Related Questions