LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 08-11-2008, 11:35 AM   #1
chexmix
Member
 
Registered: Apr 2002
Location: Arlington, MA
Distribution: Slackware, Debian, OpenBSD
Posts: 246
Blog Entries: 16

Rep: Reputation: 25
at command


Hi all -

Today I was trying to remember the syntax of the 'at' command so I could schedule a task that is typically scheduled by cron but needs to be run _sooner_ than the crontab specifies because of some server downtimes at my job (there was a power outage at one of our server locations over the weekend, due to a building being demolished nearby).

Embarrassingly, I couldn't remember the correct syntax, and the things it is doing on my local machine (Solaris 10) are kinda mystifying to me ... & I'd like to understand better so I can use this utility with some confidence.

I suspect my confusion may have to do with where stdout is going ...

My first stabs involved just trying to get something echo'd to the terminal:

art-16: at now + 1 minute
at> echo whee
at> <EOT>
commands will be executed using /bin/tcsh
job 1218471623.a at Mon Aug 11 12:20:23 2008

I expected to wait approximately 60 seconds and see "whee" echoed to the terminal, but this sequence echoes nothing ... I do, however, get emails from the system that look like this (the special chars do not quite carry over):

Your "at" job on art
"/var/spool/cron/atjobs/1218465682.a"

produced the following output:

]2;art:/home/skutch]1;skutch


If I redirect the output to a file, the file gets created and has the correct contents:

art-17: at now + 1 minute
at> echo whee > whee.txt
at> <EOT>
commands will be executed using /bin/tcsh
job 1218471815.a at Mon Aug 11 12:23:35 2008
art-18: ls whee.txt
whee.txt
art-19: cat !$
cat whee.txt
whee

I have found several suggestions online that this is the best way to fire off a timed command:

echo "/this/is/my/command" | at now + 1 hour

... with whatever time specification is desired. Perhaps I am worrying needlessly, when the usually cronned commands in question don't need to echo anything out to stdout anyway ... I was just a little mystified by this.

Thanks for any clarifications ... hope this isn't too silly a matter.

GB
 
Old 08-11-2008, 11:44 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
The at command does have an attached terminal, so it cannot output to your terminal. Imagine all sorts of backgrounded jobs dumping output on your terminal while you were typing or editing a document.
 
Old 08-11-2008, 12:10 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
And if you insist having your terminal as the target of these at commands, you can still do it that way:
Code:
$ tty
/dev/pts/3
$ echo "date  >/dev/pts/3" | at now + 1 minute
commands will be executed using /bin/ksh
job 1218474551.a at Mon Aug 11 19:09:11 2008
and one minute later:
Code:
$ Mon Aug 11 19:09:11 CEST 2008
 
Old 08-11-2008, 01:01 PM   #4
chexmix
Member
 
Registered: Apr 2002
Location: Arlington, MA
Distribution: Slackware, Debian, OpenBSD
Posts: 246

Original Poster
Blog Entries: 16

Rep: Reputation: 25
Thanks to Mr. C. and jlliagre for the responses. I believe I understand this much better now.
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Translating windows pscp command to linux scp command help robward Linux - General 2 01-17-2008 06:02 AM
startx command in FC7 reverts me back to the command prompt sriram87 Linux - Newbie 5 01-03-2008 11:18 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 08:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration