PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Automated Scheduling of tasks
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Automated Scheduling of tasks

Réponse
 
LinkBack Outils de la discussion
Vieux 18/03/2008, 21h58   #1
R C V
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Automated Scheduling of tasks

Hi,
My requirement is to start a program at a future time x and stop
it at time x+delta. Can someone tell me how I can do it
using shell scripts.

TIA,
R C
  Réponse avec citation
Vieux 18/03/2008, 22h40   #2
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks

R C V wrote:
>
> My requirement is to start a program at a future time x and stop
> it at time x+delta. Can someone tell me how I can do it
> using shell scripts.


if delta is >= 1 Minute:

man cron

--
Best regards | Monica Lewinsky's X-Boyfriend's
Cyrus | Wife for President
  Réponse avec citation
Vieux 19/03/2008, 00h49   #3
mop2
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks



Possibly the cron is a better solution, but I like the shell

set -x # for debug only

#x='2008/03/28 22:40:28'
x=`date -d+20sec "+%Y/%m/%d %H:%M:%S"`
delta='0 day 0 hour 0 min 15 sec'

x=`date -d "$x" +%s`
delta=`date -d "1969-12-30 21:00:00 +$delta" +%s`

echo x=$x\s delta=$delta\s

read -t $(($x-`date +%s`)) </dev/tty59

date;echo -e '\astart program &'

read -t $delta </dev/tty59

date;echo -e '\akill signal program'



>R C V wrote:
> My requirement is to start a program at a future time x and

stop
> it at time x+delta. Can someone tell me how I can do it
> using shell scripts.


  Réponse avec citation
Vieux 19/03/2008, 01h10   #4
R C V
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks

On Mar 18, 1:58 pm, R C V <rss...@gmail.com> wrote:
> Hi,
> My requirement is to start a program at a future time x and stop
> it at time x+delta. Can someone tell me how I can do it
> using shell scripts.
>
> TIA,
> R C



Cron s me schedule it at a future time , but does not let me kill
it after
a specified "duration".. Can someone throw some more light ?
  Réponse avec citation
Vieux 19/03/2008, 01h25   #5
mop2
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks

In you script, start a subshell to kill it.
Example:
(read -t $delta </dev/tty59;kill SIG $$)&

At your choice, read or sleep...



R C V wrote:
> On Mar 18, 1:58 pm, R C V <rss...@gmail.com> wrote:
> > Hi,
> > My requirement is to start a program at a future time x and stop
> > it at time x+delta. Can someone tell me how I can do it
> > using shell scripts.
> >
> > TIA,
> > R C

>
>
> Cron s me schedule it at a future time , but does not let me kill
> it after
> a specified "duration".. Can someone throw some more light ?

  Réponse avec citation
Vieux 19/03/2008, 03h18   #6
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks

On 2008-03-19, R C V wrote:
> On Mar 18, 1:58 pm, R C V <rss...@gmail.com> wrote:
>> Hi,
>> My requirement is to start a program at a future time x and stop
>> it at time x+delta. Can someone tell me how I can do it
>> using shell scripts.

>
> Cron s me schedule it at a future time , but does not let me kill
> it after
> a specified "duration".. Can someone throw some more light ?


Put the check into the script:

{
# put the script here
: ...
} &
sleep $delta
kill $!

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
Vieux 19/03/2008, 20h05   #7
Dan Stromberg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Automated Scheduling of tasks

On Tue, 18 Mar 2008 17:10:09 -0700, R C V wrote:

> On Mar 18, 1:58 pm, R C V <rss...@gmail.com> wrote:
>> Hi,
>> My requirement is to start a program at a future time x and stop
>> it at time x+delta. Can someone tell me how I can do it using shell
>> scripts.
>>
>> TIA,
>> R C

>
>
> Cron s me schedule it at a future time , but does not let me kill it
> after
> a specified "duration".. Can someone throw some more light ?


http://stromberg.dnsalias.org/~strombrg/maxtime.html

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h32.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13600 seconds with 15 queries