How To Shutdown Linux At Specified Time?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/shutdown-linux-specified-time/
PINTEREST
PINTEREST
INSTAGRAM

After installing updates it may needed reboot. Rebooting systems in office hours is a bad thing to happen. What can we do? We can set Linux system to restart after office hours with automated reboot. There are two ways to auto reboot. We will look both of them.

Using At Command

We can use at command to specify boot time. We can do different things with at like sending emails etc.

Now we want to restart 12:43

at provides shell to enter command. To exit from shell use CTRL+D .

  • 12:43 is the time we want to run command
  • reboot is the command we want to run

List At Jobs

We may want to list allready setup jobs with atq

Remove Pending Jobs

We can remove pending jobs with atrm command.

  • is the id of the pending job which can be find with atq command

Run After 5 Minutes

Run 6 A.M. Monday

Run 01 A.M. July 21

Using Cron

Cron is a service to run commands scripts at specified time.

Open Cron Table

To add timed task we will open cron table to add entry.

Open Cron Table With Specified User

By default cron table is opened for current user so added command will run for this user. We can specify user to run command like below

LEARN MORE  How To Manage Firewall Rules With Iptables In Linux

Add Entry Cron Table

We will add new entry to the cron table

This will shutdown our system every day at 20:00

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/shutdown-linux-specified-time/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)