Using "at" command

This is a discussion on Using "at" command within the Linux Networking forums, part of the Linux Forums category; hello, I wanted to schedule jobs to start within a space of few seconds of each other. But 'at' is ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-26-2008
R C V
 
Posts: n/a
Default Using "at" command

hello,
I wanted to schedule jobs to start within a space of few
seconds of each other. But 'at' is giving me a resolution of 'min'.
So I decided to put all tasks in a file and invoke

at -f <filename>
The contents of the <filename> are:
at now+1 minute "ls -l"
at now+2 minute "date"

But I get a error "Garbled time"

Can you tell me what is wrong here..Also is it possible to give
interval in seconds.

TIA,
R C
Reply With Quote
  #2 (permalink)  
Old 03-26-2008
Lew Pitcher
 
Posts: n/a
Default Re: Using "at" command

R C V wrote:

> hello,
> I wanted to schedule jobs to start within a space of few
> seconds of each other. But 'at' is giving me a resolution of 'min'.
> So I decided to put all tasks in a file and invoke
>
> at -f <filename>
> The contents of the <filename> are:
> at now+1 minute "ls -l"


echo ls -l | at now + 1 minute

> at now+2 minute "date"


echo date | at now + 2 minutes

> But I get a error "Garbled time"
>
> Can you tell me what is wrong here..


1) at reads stdin (or a named file) for the commands to execute
2) the time qualifier needs spaces between each of its components

> Also is it possible to give interval in seconds.


No. Time units can be minutes, hours, days, or weeks. Seconds are not
recognized as time units

> TIA,
> R C


--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


Reply With Quote
  #3 (permalink)  
Old 03-28-2008
R C V
 
Posts: n/a
Default Re: Using "at" command

It works when I pipe the command to 'at'

so $ date | at now + 2 minutes works well.
but
a) $ ls -l | at now + 2 minutes accepts the job, but gives a very
strange output in /var/spool/mail/root....

b) $killall <exec name> | at now + 2 minutes results in killall
getting executed immediately...

Am I missing something while using 'at' with those commands which have
some parameters/switches.
Also how do I get the output on the screen instead of .../mail/root..

Thanks,
R C
On Mar 26, 2:41 pm, R C V <rss...@gmail.com> wrote:
> hello,
> I wanted to schedule jobs to start within a space of few
> seconds of each other. But 'at' is giving me a resolution of 'min'.
> So I decided to put all tasks in a file and invoke
>
> at -f <filename>
> The contents of the <filename> are:
> at now+1 minute "ls -l"
> at now+2 minute "date"
>
> But I get a error "Garbled time"
>
> Can you tell me what is wrong here..Also is it possible to give
> interval in seconds.
>
> TIA,
> R C


Reply With Quote
  #4 (permalink)  
Old 03-28-2008
Bit Twister
 
Posts: n/a
Default Re: Using "at" command

On Thu, 27 Mar 2008 16:55:20 -0700 (PDT), R C V wrote:
> It works when I pipe the command to 'at'
>
> a) $ ls -l | at now + 2 minutes accepts the job, but gives a very
> strange output in /var/spool/mail/root....


> Am I missing something while using 'at' with those commands which have
> some parameters/switches.


They all executed immediately. Any output they created were given to at.

I would recommend putting any complex commands in a file
and submit the file via at.


> Also how do I get the output on the screen


Redirect results in a file and use xmessage I guess. Example:

echo "ls > ls.result
xmessage -display :0 -f ls.result
" > at.job
at -f at.job now+2minutes

> instead of .../mail/root..


Redirect results in a file. Example:
echo "ls > ls.result" > at.job
at -f at.job now+2minutes
Reply With Quote
  #5 (permalink)  
Old 04-01-2008
Chris Davies
 
Posts: n/a
Default Re: Using "at" command

R C V <rssv99@gmail.com> wrote:
> I wanted to schedule jobs to start within a space of few
> seconds of each other.


Separate them using sleep(1)

> But 'at' is giving me a resolution of 'min'.


Yes. So use at(1) to schedule the group

> So I decided to put all tasks in a file and invoke


> at -f <filename>
> The contents of the <filename> are:
> at now+1 minute "ls -l"
> at now+2 minute "date"


Arrgghh. You're using at(1) to schedule at(1)!? There are occasions when
this makes sense, but this isn't one of them.

at 10pm <<!
task1 >/tmp/task1.out 2>/tmp/task1.err &
sleep 5
task2 >/tmp/task2.out 2>/tmp/task2.err &
sleep 5
task3 >/tmp/task3.out 2>/tmp/task3.err &
wait
!

Chris
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:16 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0