In this tutorial we will show you how to use the unix at command.
Through the Unix AT commands, we can run a set of commands at a particular time, which is really helpful in scheduling tasks in a Linux environment.
For this tutorial, we will show you how to restart the Unix server by using this command.
Step 1 – Enter command in terminal application
First of all, in the terminal application, let’s type date and hit enter. This command will show you the current date and time of your machine.
When setting up an AT command, you have to first define the time in which the set of commands are going to be performed, and then define the tasks which are to be performed.
For that, first let’s type in the command
“sudo at 04:11” and hit enter.
Step 2 – Type any command
With the time scheduled, the AT command line will show up. Over here, you can type in the set of instructions you want the Linux server to perform. For example, over here, we will type in the command “shutdown –r now” and hit enter.
The “now” attribute over here will automatically restart the server without prompting the user. If you don’t use this attribute over here, the server will ask when the machine should be restarted.
In this case, it should be noted that without this attribute, the unix at command won’t perform the set of instructions we have laid out.
Step 3 – Execute the schedule
With that done, simply press the Ctrl + D shortcut key to execute the schedule. With that done, you can see that the machine will restart according to the scheduled time.
And that’s it, this way you can create a schedule for your system using the Unix AT commands.