Results 1 to 2 of 2
Hi all,
I'm totally new to Linux scripting and I need a script that every day runs a program on a specified time and stop it on another specified time.It ...
- 09-07-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 3
Program rerun scrip
Hi all,
I'm totally new to Linux scripting and I need a script that every day runs a program on a specified time and stop it on another specified time.It should also have the ability to set it for every weak or month (besides every day) and specified date and time.
Does any one have such script? or could you help me on how to write it?
Thanks
- 09-07-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
In bash, the basic thing would be something like this:
To start it, you can use the cron or at daemons. Cron, by default, has folders under /etc/cron* to run things hourly, daily, weekly,.... It should stop without a problem when sleep ends (use man sleep to see the manual page for that command to customize the time).Code:#!/bin/bash #change this for the program/command to run <my command>& pid_of_my_command=$! sleep <whatever_time> kill -SIGKILL $pid_of_my_command
That's the basic idea.


Reply With Quote