LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-07-2011, 05:50 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 70
A question about the at scheduler...


Reading the man page says that it takes commands from stdin and that it uses /bin/sh to execute commands.

When I run
Code:
echo "eject" | at now + 1 minute
It doesn't run because obviously sh /usr/bin/eject will not work. /bin/sh is only for scripts not binaries. So this forces me to put the command /usr/bin/eject in a file then run sh file.

Is there any other way around that? Just curious.
 
Old 03-07-2011, 05:59 PM   #2
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Original Poster
Rep: Reputation: 70
Nevermind, it's a dumb question.
Code:
echo /usr/bin/eject > script.sh;echo "sh script.sh" | at now + 1 minute
 
Old 03-07-2011, 06:30 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
You shouldn't need to put it in a script. I would expect that first example you posted to have worked (assuming permissions and environment allowed for it)
 
Old 03-07-2011, 06:39 PM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
It doesn't run because...
Full path names will help avoid some problems, but your text runs fine here, exactly as you typed.

Do the commands eject and /usr/bin/eject run okay for you directly from the command line?
 
Old 03-07-2011, 07:53 PM   #5
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Original Poster
Rep: Reputation: 70
Yes they do, eject is in the path and yes /usr/bin/eject works fine. But if I do
Code:
echo "/usr/bin/eject" | at now + 1 minute
it gets scheduled but never executes. Even tried
Code:
echo -n "/usr/bin/eject" | at now + 1 minute
Would the newline matter?
Yet it works if I put it in a script.
man at specifically says it uses /bin/sh to execute the command. So /bin/sh /usr/bin/eject would not work.
 
Old 03-07-2011, 08:10 PM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Code:
echo "exec /usr/bin/eject" | at now + 1 minute
 
Old 03-07-2011, 08:16 PM   #7
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Is the at scheduler daemon running?

ps ax | grep /usr/sbin/atd | grep -v grep

You say the job gets scheduled. Just to be sure, after executing the command, run atq to verify the command is in the at spool queue. You should see the job file in /var/spool/atjobs.

When you view the job in the spool directory you should see something like this:

Code:
#!/bin/sh
# atrun uid=1000 gid=1000
# mail slacky 0
umask 22
...
...
/usr/bin/eject
The middle of the text will be filled with environment variables.

Do you have a file at /usr/sbin/atrun?

Is /bin/sh linked to a valid shell command, such as /bin/bash?
 
  


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
Scheduler available on Linux? NY-Ed Linux - Newbie 1 10-12-2010 10:13 AM
About Control-M Scheduler Uday123 Solaris / OpenSolaris 3 11-27-2007 10:56 AM
Scheduler Software. hammanu Linux - Software 5 11-02-2007 09:45 AM
wget scheduler varaahan Linux - Desktop 2 10-25-2006 07:27 PM
scheduler... os2 Programming 0 07-24-2004 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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