how to start script in 30 seconds - HP UX
This is a discussion on how to start script in 30 seconds - HP UX ; I guess my users are impatient. I'm trying to use a script that uses
the 'at' command to start scripts. I use
at now + 1 minutes
../startscripts
ctrld
now but when I replace 1 minutes with 0.5 minutes or ...
-
how to start script in 30 seconds
I guess my users are impatient. I'm trying to use a script that uses
the 'at' command to start scripts. I use
at now + 1 minutes
../startscripts
ctrld
now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
a bad date specification.
What the alternative?
Mike
-
Re: how to start script in 30 seconds
mmccaws2 wrote:
> I guess my users are impatient. I'm trying to use a script that uses
> the 'at' command to start scripts. I use
> at now + 1 minutes
> ./startscripts
> ctrld
>
> now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> a bad date specification.
>
> What the alternative?
>
> Mike
sleep 30 && ./startscripts &
--
Michael Tosch @ hp : com
-
Re: how to start script in 30 seconds
On Apr 17, 12:37 pm, Michael Tosch
wrote:
> mmccaws2 wrote:
> > I guess my users are impatient. I'm trying to use a script that uses
> > the 'at' command to start scripts. I use
> > at now + 1 minutes
> > ./startscripts
> > ctrld
>
> > now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> > a bad date specification.
>
> > What the alternative?
>
> > Mike
>
> sleep 30 && ./startscripts &
>
> --
> Michael Tosch @ hp : com
Oh but I won't be able to log off.
-
Re: how to start script in 30 seconds
mmccaws2 wrote:
> On Apr 17, 12:37 pm, Michael Tosch
> wrote:
> > mmccaws2 wrote:
> > > I guess my users are impatient. I'm trying to use a script that uses
> > > the 'at' command to start scripts. I use
> > > at now + 1 minutes
> > > ./startscripts
> > > ctrld
> >
> > > now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> > > a bad date specification.
> >
> > > What the alternative?
> >
> > > Mike
> >
> > sleep 30 && ./startscripts &
> >
> > --
> > Michael Tosch @ hp : com
>
> Oh but I won't be able to log off.
nohup(1)
-
Re: how to start script in 30 seconds
On Apr 17, 1:37 pm, Frank Slootweg wrote:
> mmccaws2 wrote:
> > On Apr 17, 12:37 pm, Michael Tosch
> > wrote:
> > > mmccaws2 wrote:
> > > > I guess my users are impatient. I'm trying to use a script that uses
> > > > the 'at' command to start scripts. I use
> > > > at now + 1 minutes
> > > > ./startscripts
> > > > ctrld
>
> > > > now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> > > > a bad date specification.
>
> > > > What the alternative?
>
> > > > Mike
>
> > > sleep 30 && ./startscripts &
>
> > > --
> > > Michael Tosch @ hp : com
>
> > Oh but I won't be able to log off.
>
> nohup(1)
so there is no way to use the 'at now +' command options? maybe I can
query the time add thirty seconds then initiate the at command.
Mike
-
Re: how to start script in 30 seconds
On Apr 17, 1:46 pm, mmccaws2 wrote:
> On Apr 17, 1:37 pm, Frank Slootweg wrote:
>
>
>
> > mmccaws2 wrote:
> > > On Apr 17, 12:37 pm, Michael Tosch
> > > wrote:
> > > > mmccaws2 wrote:
> > > > > I guess my users are impatient. I'm trying to use a script that uses
> > > > > the 'at' command to start scripts. I use
> > > > > at now + 1 minutes
> > > > > ./startscripts
> > > > > ctrld
>
> > > > > now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> > > > > a bad date specification.
>
> > > > > What the alternative?
>
> > > > > Mike
>
> > > > sleep 30 && ./startscripts &
>
> > > > --
> > > > Michael Tosch @ hp : com
>
> > > Oh but I won't be able to log off.
>
> > nohup(1)
>
> so there is no way to use the 'at now +' command options? maybe I can
> query the time add thirty seconds then initiate the at command.
>
> Mike
while looking at man at again i see
at -f $HOME/future -t201312271220.00
is there a way of generating the date output similar to the format
used in the example
[year][month][day][24 hour][minute].[sec] + 30 sec.
Mike
-
Re: how to start script in 30 seconds
mmccaws2 wrote:
> On Apr 17, 1:37 pm, Frank Slootweg wrote:
> > mmccaws2 wrote:
> > > On Apr 17, 12:37 pm, Michael Tosch
> > > wrote:
> > > > mmccaws2 wrote:
> > > > > I guess my users are impatient. I'm trying to use a script that uses
> > > > > the 'at' command to start scripts. I use
> > > > > at now + 1 minutes
> > > > > ./startscripts
> > > > > ctrld
> >
> > > > > now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> > > > > a bad date specification.
> >
> > > > > What the alternative?
> >
> > > > > Mike
> >
> > > > sleep 30 && ./startscripts &
> >
> > > > --
> > > > Michael Tosch @ hp : com
> >
> > > Oh but I won't be able to log off.
> >
> > nohup(1)
>
> so there is no way to use the 'at now +' command options? maybe I can
> query the time add thirty seconds then initiate the at command.
If you're really doing it the way you're saying, you can just do:
at now
sleep 30
../startscripts
ctrld
But you said "I'm trying to use a script that uses the 'at' command to
start scripts.". If you really are using a *script* that uses the 'at'
command, then you will have to insert the "sleep 30" either in the
invoking script or the invoked script. However your example is not a
script, but commands entered at the command line (in a script you can't
have commands after the "at" command and you can't have a ctrld (well
you can do *similar* things, but not those exact things)).
BTW, IIRC "at now", i.e. without '+ ...' can sometimes give problems
because the imaginary time 'now' has already passed when at(1) actually
executes. IIRC, the at(1) manual page has another command which is
essentially a "at now" but without the mentioned problem. IIRC, that
other command is 'batch'.
-
Re: how to start script in 30 seconds
mmccaws2 wrote:
> is there a way of generating the date output similar to the format
> [year][month][day][24 hour][minute].[sec] + 30 sec.
date +%Y%m%d%H%M.%S
You'll have to figure out how to add 30.
-
Re: how to start script in 30 seconds
mmccaws2 wrote:
> On Apr 17, 12:37 pm, Michael Tosch
> wrote:
>> mmccaws2 wrote:
>>> I guess my users are impatient. I'm trying to use a script that uses
>>> the 'at' command to start scripts. I use
>>> at now + 1 minutes
>>> ./startscripts
>>> ctrld
>>> now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
>>> a bad date specification.
>>> What the alternative?
>>> Mike
>> sleep 30 && ./startscripts &
>>
>> --
>> Michael Tosch @ hp : com
>
> Oh but I won't be able to log off.
(sleep 30 && ./startscripts &) /dev/null 2>&1
--
Michael Tosch @ hp : com
-
Re: how to start script in 30 seconds
mmccaws2 writes:
> I guess my users are impatient. I'm trying to use a script that uses
> the 'at' command to start scripts. I use
> at now + 1 minutes
> ./startscripts
> ctrld
>
> now but when I replace 1 minutes with 0.5 minutes or 30 seconds I get
> a bad date specification.
>
> What the alternative?
Besides reading "man at" users could use "man batch".
>
> Mike
-
Re: how to start script in 30 seconds
Dennis Handly writes:
> mmccaws2 wrote:
>
>> is there a way of generating the date output similar to the format
>> [year][month][day][24 hour][minute].[sec] + 30 sec.
>
> date +%Y%m%d%H%M.%S
> You'll have to figure out how to add 30.
perl -e 'print scalar(localtime(time + 30)), "\n"'
or
perl -e 'use POSIX; print scalar(strftime("%Y%m%d%H%M.%S", localtime(time + 30))), "\n"'
Ulrich