1

I have a process which is designed to do a specific task in case of events. Requirement is to run a specific command 50 seconds after an event occurs.

Cannot modify the code to put sleep there as it would block the process flow.

Can it be done via cron or any other unix commands?

regards

1 Answer 1

3

Create a bash script, start it with "sleep 50s" and then call the program or command you wnat to run.

5
  • That's one way of doing it. Is there way of scheduling a job?
    – chingupt
    May 1, 2013 at 9:22
  • 1
    If the simple way of doing it is enough, why try to make it more complex ? KISS principle applies. (This hints to me you aren't explaining properly what you actually want to do).
    – Stephane
    May 1, 2013 at 9:25
  • This is what i wanted to do. But didn't actually feel right. My process will launching a script which in turn will be launching this script to run after ~50 seconds. Too many script calls. If i am able to configure a cron, then all i need to do is set the cron and let system handle it itself.
    – chingupt
    May 1, 2013 at 9:29
  • Well, you can use the at command to schedule a task to run at a specific time if it makes you feel better.
    – Stephane
    May 1, 2013 at 9:31
  • in that case ill have to first calculate the time after 50 seconds and then run the at command. rt? or i can specify the at command to run after ~50 secs?
    – chingupt
    May 1, 2013 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .