Posts

Showing posts from November, 2019

Schedule your tasks with 'at' utility

Image
Photo by JESHOOTS.COM on Unsplash In this post, I am going to share you about a utility in Linux for scheduling your scripts. I will be showing how you can use a very simple and easy utility called ‘at’. First of all, if its not already install you can install it by running: # yum install at -y Now that at is installed. You can start the atd daemon: # yum start atd We are all set we can now schedule tasks. For our case we will use an example script ‘example.sh’ which will broadcast a message to the wall: echo “Script is running” | wall We will schedule the script to run now: # at -f example.sh now We can run at a specific time as: # at -f example.sh 10:30 We can view the scheduled tasks by running atq command: # atq To remove a task from the at queue, you can run ‘at -d task_number’. For example to remove task with id 4 we would run : # at -d 4 By default the queue name of tasks added with ‘at’ command is a. You can set a new queue name