LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-01-2007, 10:48 PM   #1
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

Rep: Reputation: 38
Returning from the 'at' command prompt?


I think I've got the jist of the 'at' command. When I say something like 'at 5am tomorrow' it gives me a 'at>' prompt. I can enter the commands I want it to perform, but how do I get out of it? I've tried ctrl-c, which gets me out, but running 'atq' shows me nothing. How do I return from the prompt with my commands saved?
 
Old 03-01-2007, 11:05 PM   #2
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Try Ctrl-D

That's your fix. Now I have a problem:

I type:

at 9:37
>xmms
Ctrl-D

I get:

job 3 at 2007-03-02 09:37


Nothing happens at 9:37. What do I do?

Last edited by gregorian; 03-02-2007 at 07:46 PM.
 
Old 03-02-2007, 11:12 AM   #3
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

Original Poster
Rep: Reputation: 38
gregorian,

Thank you. Your Ctrl-D solution worked.

I used 'at 11:00am' and entered 'touch blah.txt', and it created the file at the specified time. Could it be because you didn't specify am/pm? I also tested it as a nonroot user just to be sure it wasn't a permissions thing, and it worked fine.
 
Old 03-02-2007, 03:22 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Does xmms work from the command line with no intervention?

Perhaps you should try it with the path to xmms in case it's and environment issue
 
Old 03-02-2007, 07:19 PM   #5
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Yes, xmms runs from the command line by typing xmms.

I typed:

Code:
$at 5:46am
at>xmms (Ctrl-D)

job 15 at 2007-03-03 05:46

$>atq
job 15 at 2007-03-03 05:46
This comes any time before 5:46 when you type atq. After 5:46, atq displays nothing as expected, but xmms does not run.Even the command 'ls' wont run.

But the strange thing is: your command 'touch blah.txt' worked for at! I tried to run a shell script that plays a video using mplayer. I heard the song without the video! Sometimes it plays the sound only for about a second!


Are there any limitations for what the at command can run?

EDIT: I wrote a script called sc which echoes "Hi", and tried to run it in the following ways:
Code:
at> test/sc
at> ~/test/sc
at> /home/username/test/sc
at> <EOT>
job 27 at 2007-03-03 06:08
Even if one of these methods of invoking is right, it should have given me atleast a single "Hi", but it didn't.

Last edited by gregorian; 03-02-2007 at 07:47 PM.
 
Old 03-02-2007, 09:42 PM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'm not sure how at handles screen stuff, since its running in the background in a way. For example, if I use wget from at, I don't get any record of the characters that would normally be displayed on screen (at least I don't think I do)
 
Old 03-02-2007, 10:48 PM   #7
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Hmmm... rm command also works. Can anybody tell me what are the limitations of 'at' . Is it restricted only to shell commands? Only those have worked for me so far.

I've read the man page of 'at' but I cant find more information.
 
Old 03-03-2007, 02:48 AM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Xmms is a graphical application. I'm not 100% certain how it works, but I would guess that at is executing the command in a more limited environment without any reference to the DISPLAY environment variable. Therefore xmms isn't able to open a Window on your DISPLAY.

You might try one of the several command line mp3 players if you just want an mp3 played at a particular time.
 
Old 03-03-2007, 03:11 AM   #9
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Ok, I tried at>mplayer song.mp3.

Like the video I tried to play before, it plays it for about one second and stops. Can you try it out? I want to know if only I have the problem.

EDIT: I just observed this:

at>mplayer song.mp3 <EOT> #Press (Ctrl-DD)

will play the whole song, but

at>mplayer song.mp3
at><EOT> #Press Ctrl-D

will play it only for second. Does this mean that 'at' will go to the next line and stop the previous command even though it is still running?

Also, while issuing the at command, this is displayed:

Quote:
warning: commands will be executed using (in order) a) $SHELL b) login shell c) /bin/sh
When I type ps -e during the song play, I see sh listed. Does this mean that 'at' has bypassed a) and b) For me $SHELL= /bin/bash

Last edited by gregorian; 03-03-2007 at 03:25 AM.
 
Old 03-08-2007, 05:19 PM   #10
brammeleman
LQ Newbie
 
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
Try setting the display variable explicitly, for example:
Code:
echo "DISPLAY=:0.0 xclock" | at now + 1 minute
The man-page does mention something about the display variable:
Quote:
The working directory, the environment (except for the variables TERM, DISPLAY and _) and the umask are retained from the time of invocation.
What really helps when debugging this kind of problems: Installing mail! You'll get mail messages from at/cron (and friends) when your scheduled jobs fail. For debian/ubuntu systems, just install the packages postfix and mailutils, select "Local only" when you are asked what type of postfix config you want.
When your scheduled command is not executed, type 'mail' to check your local mailbox. The mail usually explains what has gone wrong.

Good Luck!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
'at' command not working minike Slackware 9 03-04-2006 08:59 PM
can't capture 'at' command standard output to a file bartoni Linux - General 3 02-28-2006 04:52 PM
'at' command "Cannot open display" Gregory Deal Linux - Software 2 09-30-2004 09:06 PM
DIR and LS command returning *s linmonkey Linux - Newbie 2 07-10-2004 06:45 PM
returning to command line from a SIGTSTP Ctawp Programming 1 12-07-2003 10:52 PM


All times are GMT -5. The time now is 04:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration