Comments on: How to Use ‘at’ Command to Schedule a Task on Given or Later Time in Linux https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 13 Jul 2023 15:03:21 +0000 hourly 1 By: Santosh https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/comment-page-1/#comment-1129045 Wed, 10 Apr 2019 18:20:25 +0000 http://www.tecmint.com/?p=22055#comment-1129045 How to add date along with time.

]]>
By: Ravi Saive https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/comment-page-1/#comment-805517 Mon, 08 Aug 2016 05:48:57 +0000 http://www.tecmint.com/?p=22055#comment-805517 In reply to Jalal Hajigholamali.

@Jalal,

Thanks for finding it useful, and corrected in the writeup..

]]>
By: Jalal Hajigholamali https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/comment-page-1/#comment-805255 Sun, 07 Aug 2016 05:59:59 +0000 http://www.tecmint.com/?p=22055#comment-805255 Hi,
Very useful article

remove extra ‘d ‘ from atdd

# chkconfig –level 35 atdd on

]]>
By: Marcelo https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/comment-page-1/#comment-804590 Thu, 04 Aug 2016 18:55:48 +0000 http://www.tecmint.com/?p=22055#comment-804590 Very useful, thank you!

]]>
By: Sergey Podushkin https://www.tecmint.com/linux-cron-alternative-at-command-to-schedule-tasks/comment-page-1/#comment-804378 Thu, 04 Aug 2016 01:48:49 +0000 http://www.tecmint.com/?p=22055#comment-804378 Good article, Gabriel!

Just my 5 cents to it.

“at” can be used to start something on background, like nohup staff, but more short:
$ echo “rsync remote_resource local_resource” | at now
or
$ at -f /path/to/my/script -m now
just notice “-f script” option – it’s very convenient to run more complex staff

“at” can be used instead of cron to run something repeatedly after the first execution ends. This can eliminate cronjobs, scheduled to run each minute with various locks to avoid to run several commands simultaneously. One can add at the end of its script:
—— bash code snippet —–
# script payload here
this_script_name=$(basename $0)
this_script_path=$(readlink –canonicalize $(dirname $0))
at -f $this_script_path/$this_script_name now
—— bash code snippet —–
this will start the script again when it’s finished.

Another interesting application that’s unable to implement with cron is periodically execution with random intervals. Mostly the same as abouve, but just add random delay:
—— bash code snippet —–
# script payload here
this_script_name=$(basename $0)
this_script_path=$(readlink –canonicalize $(dirname $0))
MIN_DELAY=15
RANDOM_BIAS=20
delay=$(( ($RANDOM % $RANDOM_BIAS) + $MIN_DELAY ))
at -f $this_script_path/$this_script_name now + $delay min
—— bash code snippet —–

That’s all :)

]]>