Setting up command/script by defining the specific 2nd

I'm making use of bash and also asking yourself just how I can execute a command/script at a later specific time, with the precision of a 2nd?

I read the male web page for the at-command, yet regarding I can recognize it's just feasible define mins (and also not secs). Now I first make use of at and afterwards sleep to get it to execute the appropriate secondly. To show, if I would love to run my_script. sh at 22.21.05 I would certainly do:

echo "sleep 5;" | at 22.21

Yet it would certainly be much better to have a command with it constructed in. Something like at 22.21.05.

2019-05-06 22:42:07
Source Share
Answers: 2

I do not think that this is feasible. cron is just granular to the min and also the at energy hooks right into it to do it's job. I assume you have the appropriate remedy - - resting for x secs prior to implementing.

2019-05-08 18:52:30

You can make your strategy right into a function :

atplus () { local sec=${1##*.} time=${1%.*}; shift; echo "sleep $sec; [email protected]" | at $time; }

Try it out :

atplus 22.21.05

You need to realize, nonetheless, that accuracy is not assured.

2019-05-08 18:46:28