LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   More accurate task scheduler (https://www.linuxquestions.org/questions/linux-general-1/more-accurate-task-scheduler-291539/)

lowspeed 02-17-2005 04:25 PM

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 !

Dark_Helmet 02-17-2005 04:45 PM

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


lowspeed 02-17-2005 04:49 PM

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.

Dark_Helmet 02-17-2005 05:00 PM

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.

lowspeed 02-17-2005 06:56 PM

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.

Dark_Helmet 02-17-2005 07:09 PM

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.

lowspeed 02-17-2005 07:14 PM

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 ?

Dark_Helmet 02-17-2005 08:21 PM

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.


All times are GMT -5. The time now is 02:57 PM.