LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2007, 11:48 PM   #1
jiya_31
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Rep: Reputation: 0
"at" command


i need to make my process execution terminal free.
For this i can run them using "at" command. But to execute directly without reading the command from a file i use = at 'time' and press ENTER, then, at> (at prompt) appears on the screen on which i write the command to be executed.
Though this solves my purpose by my aim to attain the same functionality programatically.I dont want to type everything on the console and do it. can anybody suggest me, how to do that exceot using scripts?
 
Old 10-19-2007, 01:07 AM   #2
PAix
Member
 
Registered: Jul 2007
Location: United Kingdom, W Mids
Distribution: SUSE 11.0 as of Nov 2008
Posts: 195

Rep: Reputation: 40
Hi and welcome,

Not quite sure what you are doing, but from what you say you seem to be invoking the at program as follows, and then hitting ctl+D to facilitate exit from the at program.
Code:
yourprompt> at 08:00
at> programname
at> <EOT>
job 20 at 2007-10-19 09:00
yourprompt>
I imagine that the screen looks a bit like that.

if you try this
Code:
yourprompt> at -f programname 09:00
warning: commands will be executed using /bin/sh
job 21 at 2007-10-19 09:00
The warning can be redirected to /dev/null or a log file if required.
Code:
yourprompt> at -f programname 09:00 2> /dev/null
yourprompt>
You needn't launch the real program, but could launch a script that calls the real program. My requirement at home is trivial, the batch program can't run sound, but the program it calls can utilise the sound card, a trivial Morse beacon program that reads a serial number from a file, increments the serial number and writes it back and writes the obtained serial number into a short beacon message replete with transmitter callsign etc At the end of the program II also have the program re queue itself five minutes later as long as either the serial number hasn't exceeded a set limit or the time of day exceeds a set limit. The world is your oyster.

I hope that I have given the information that you seek and I will of course look back later in the day to check if you have any further issues on the subject that I might help you with. The at man page should give you more than a few clues about expressing time for execution. So that's you virtually busy during your next holiday then. All you have to do is get the box to email the boss each day you are sipping lemonade in the sun, to tell him that the system is fine, the financials run is complete and what a good job you are doing in the engine room.

PAix
 
Old 10-19-2007, 01:09 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
i need to make my process execution terminal free.
It would be easier to read your question if you capitalized the personal pronoun "I".

If you are using "at" simply because you want to be able to log off and have the program continue, then you can use "nohup" or "screen". Nohup will detach the terminal and log the output to a file. Screen allows you to detach the console and later re-attach it.

You might also want to read up on using cron. Also, many programs have --quiet options to prevent terminal output, but you can still redirect any input or output of a script to a file or /dev/null to allow it to run as a cron job.

Last edited by jschiwal; 10-19-2007 at 01:12 AM.
 
Old 10-19-2007, 02:19 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Code:
at now <<EOF
date
ls
EOF
Code:
echo /bin/date | at now
useful for reminders...
Code:
at midnight <<EOF
cat
don't forget to put 
the cat out
`date`
EOF

Last edited by bigearsbilly; 10-19-2007 at 02:22 AM.
 
Old 10-20-2007, 08:50 AM   #5
PAix
Member
 
Registered: Jul 2007
Location: United Kingdom, W Mids
Distribution: SUSE 11.0 as of Nov 2008
Posts: 195

Rep: Reputation: 40
Quote:
You might also want to read up on using cron.
Please correct me if I am at all wrong in anything I say.

I seem to recollect that a minor difficulty that I encountered using cron on a Solaris box was that cron doesn't use the environment of the user, so additional work has to be done to ensure that the test running done during development in a rich environment holds good when exposed to the austere environment in which cron actually runs.

I believe also that there is an anomally (untested) in the way SUSE 10.* handles jobs. Is there a problem with running a job at the same time each day? I have a feeling that it is a bit cavalier in the way it handles the timing. Perhaps someone can enlighten us here.

The attraction of at is that it runs in the familiar user environment and so is relatively facile to implement.

PAix
 
Old 10-22-2007, 02:55 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
cron doesn't guarantee to run on time I don't think.

I used to run suse for years and years and I found it intensely irritating all the cron jobs
it would have by default, you'd be sitting there and then notice your disk spinning away
and your cpu load up while it was doing an updatedb or a find or some other nonsense
I didn't ask for.
In the end I just gzipped the scripts up to stop them running.
(I didn't rm them in case I regretted it)
 
  


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
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Make "ls" command show colors without "--color=always" switch SharpyWarpy Linux - General 4 07-16-2007 11:00 PM
"list dynamic dependency" of an executable using command other than "ldd" Amrita@3086 Solaris / OpenSolaris 3 04-04-2007 04:56 AM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM
"segmentation error" when issuing "useradd" command through terminal with RH 9.0 kaihuang Linux - General 0 10-21-2003 11:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 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