Pradeep Bhadani
Pradeep Bhadani

Reputation: 4721

How to Schedule Unix Shell Script without CronJob

I want to schedule some unix scripts such that they run on specific time. I know how to do this using cron job but htere is limitation that i cant use cron jobs.

Is there any way to schedule scripts?

Upvotes: 0

Views: 6243

Answers (2)

Igor Chubin
Igor Chubin

Reputation: 64563

There are several ways, that you could use to start a script periodically:

  1. Use anacron. The script will be started only during reboot (or when anacron is explicitly started), but not more often than one time in specified time interval.
  2. Use cron.
  3. Use at/atd. You specify the time when you want to start the script. Then the script must reschedule itself for the next start.
  4. You write program that runs always and checks what time is it now, and if it the time, then it starts your script. That is a selfmade cron, actually.

Upvotes: 1

Johannes Overmann
Johannes Overmann

Reputation: 5131

You can start a screen session and use a wrapper shell script which sleeps for the appropriate time. But this is hacky.

You can detach from the screen session and leave it running when logging out which solves that part of the problem. The rest is nasty shell script code.

Upvotes: 1

Related Questions