Need help in 'at' command

This is a discussion on Need help in 'at' command within the Linux Networking forums, part of the Linux Forums category; Hello, While using the 'at' command it works when I pipe the command I want to schedule to 'at' So $ ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

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

Hello,
While using the 'at' command it works when I pipe the command I
want to schedule 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..
Do I use some other command to schedule jobs using shell scripts.

Thanks,
R C
Reply With Quote
  #2 (permalink)  
Old 03-28-2008
Peter Ludikovsky
 
Posts: n/a
Default Re: Need help in 'at' command

R C V wrote:
> Hello,
> While using the 'at' command it works when I pipe the command I
> want to schedule 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..
> Do I use some other command to schedule jobs using shell scripts.
>
> Thanks,
> R C


a) echo "ls -l" | at now + 2 minutes works for me
b) echo "killall foobar | at now + 2 minutes" works for me too

It's all in the echo...
Reply With Quote
  #3 (permalink)  
Old 03-28-2008
Jurgen Haan
 
Posts: n/a
Default Re: Need help in 'at' command

R C V wrote:
> Hello,
> While using the 'at' command it works when I pipe the command I
> want to schedule 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..
> Do I use some other command to schedule jobs using shell scripts.
>
> Thanks,
> R C


You're actually inserting the output of 'ls -l' and 'killall' into at.
It kinda makes sense at does not understand it.
The pipe '|' passes STDOUT of one process through to STDIN of another
process.

Output of at is sent to the mail spooler because at does not run in an
attached TTY. It's a service that runs in the background, so it cannot
output stuff to the TTY from which you inserted the task.

But erm. If you really just wat to delay stuff a bit, you might try
using 'sleep' instead.

'sleep 120 && ls -l'

-R-
Reply With Quote
  #4 (permalink)  
Old 03-28-2008
Peter Ludikovsky
 
Posts: n/a
Default Re: Need help in 'at' command

Jurgen Haan wrote:
> R C V wrote:


[cut]

> But erm. If you really just wat to delay stuff a bit, you might try
> using 'sleep' instead.
>
> 'sleep 120 && ls -l'
>
> -R-


Not quite the same. at lets you log out (or close the console window),
whereas sleep requires you to stay logged on or else it gets killed.

/peter
Reply With Quote
  #5 (permalink)  
Old 03-28-2008
Jurgen Haan
 
Posts: n/a
Default Re: Need help in 'at' command

Peter Ludikovsky wrote:
> Jurgen Haan wrote:
>> R C V wrote:

>
> [cut]
>
>> But erm. If you really just wat to delay stuff a bit, you might try
>> using 'sleep' instead.
>>
>> 'sleep 120 && ls -l'
>>
>> -R-

>
> Not quite the same. at lets you log out (or close the console window),
> whereas sleep requires you to stay logged on or else it gets killed.
>
> /peter


That's true, but that also kinda summarizes the reason why output from
AT is not possible. Ofc, 'screen' can be used for sleep. ;)

-R-
Reply With Quote
  #6 (permalink)  
Old 04-02-2008
Chris Davies
 
Posts: n/a
Default Re: Need help in 'at' command

> Not quite the same. at lets you log out (or close the console window),
> whereas sleep requires you to stay logged on or else it gets killed.


Jurgen Haan <jurgen@fake.tld> wrote:
> That's true, but that also kinda summarizes the reason why output from
> AT is not possible


So redirect your "at" command to write to a file
Chris
Reply With Quote
  #7 (permalink)  
Old 04-03-2008
Jurgen Haan
 
Posts: n/a
Default Re: Need help in 'at' command

Chris Davies wrote:
>> Not quite the same. at lets you log out (or close the console window),
>> whereas sleep requires you to stay logged on or else it gets killed.

>
> Jurgen Haan <jurgen@fake.tld> wrote:
>> That's true, but that also kinda summarizes the reason why output from
>> AT is not possible

>
> So redirect your "at" command to write to a file
> Chris


Yup... Not a bad plan, or wrap your command in a script.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB 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 05:37 PM.


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