LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-17-2005, 05:25 PM   #1
lowspeed
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Rep: Reputation: 0
More accurate task scheduler


Hi all,


i'm looking for a way to schedule a task at a certain date and time

crontab repeats and doesn't have seconds...

At doesn't include seconds either ...

So i'm basically looking for something that i can either schedule at specific seconds to the future or a specific time HH:MM:SS MMDDYYYY



Thanks !
 
Old 02-17-2005, 05:45 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
First off, I find it odd that there would be a need to launch something at a specific second.

That said, then just create a shell script, use at or cron, and have the shell script execute the sleep command for however many seconds you need, then launch the program you want. So, if you wanted something to start at 10:15:22, set up an at job to kick off at 10:15, and point to a shell script that looks something like:
Code:
#!/bin/bash

sleep 22
execute_something_cool_here
 
Old 02-17-2005, 05:49 PM   #3
lowspeed
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Dark_Helmet
First off, I find it odd that there would be a need to launch something at a specific second.

That said, then just create a shell script, use at or cron, and have the shell script execute the sleep command for however many seconds you need, then launch the program you want. So, if you wanted something to start at 10:15:22, set up an at job to kick off at 10:15, and point to a shell script that looks something like:
Code:
#!/bin/bash

sleep 22
execute_something_cool_here

I thought of doing it this way.

But its kinda clumsy cause then i need to pass the script the seconds difference.
 
Old 02-17-2005, 06:00 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Then pass the number of seconds as an argument to the script. For instance my_special_job 10:15:22

Code:
#!/bin/bash

seconds=$(echo $1 | cut -f 3 -d ':')

sleep ${seconds}
execute_something_cool_here
You could even take it to the next level, and specify the command... my_special_job 10:15:22 something_cool -qrst

Code:
#!/bin/bash

seconds=$(echo $1 | cut -f 3 -d ':')
shift

sleep ${seconds}
$@
Actually, I don't honestly know if that last bit would work (haven't tried it), but it is possible to massage it if it doesn't.

Last edited by Dark_Helmet; 02-17-2005 at 08:06 PM.
 
Old 02-17-2005, 07:56 PM   #5
lowspeed
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Any idea why i'm getting this error ?

"Can't signal atd (permission denied)"

when i do atq i see it added to the shched and it also performs the script or task.


But it doesnt remove tasks that were already done from the atq list


if i run the at command under root it works.
 
Old 02-17-2005, 08:09 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Do either of these files exist: /etc/at.allow or /etc/at.deny?

If they do, make sure whatever user you need is allowed access. If neither exist, then only root is allowed to use at.
 
Old 02-17-2005, 08:14 PM   #7
lowspeed
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Dark_Helmet
Do either of these files exist: /etc/at.allow or /etc/at.deny?

If they do, make sure whatever user you need is allowed access. If neither exist, then only root is allowed to use at.

Yeah sorry i didn't mention

but i put in the /etc/at.allow the username

and the at.deny is empty.

Any other suggestions ?
 
Old 02-17-2005, 09:21 PM   #8
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Did you restart the daemon after adding the user? Or was the user already in the file when the daemon started?

Otherwise, I'm not sure. I'd have to look at the source to get an idea of what can cause that message to be displayed.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How accurate is LM_Sensors Mojojo Linux - Software 0 12-23-2004 08:49 AM
Finding accurate IRQ #'s? Ineed2muchHelp Linux - Networking 4 06-21-2004 06:09 PM
task scheduler? is there any? bruno buys Linux - General 1 11-17-2003 04:09 PM
How do I keep accurate time? teeno Linux - Software 8 10-11-2003 08:04 PM
CPU info, is it accurate? ALF Linux - Software 3 08-03-2003 11:45 PM


All times are GMT -5. The time now is 02:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration