Crontab Reboot on CentOS 7

General support questions
Post Reply
Bone8Head
Posts: 1
Joined: 2015/11/02 10:35:39

Crontab Reboot on CentOS 7

Post by Bone8Head » 2015/11/02 10:38:26

Hello guys.

I'm trying to Schedule an automatic reboot for my CentOS Server everyday at the 08:30 (a.m).
I put (with crontab -e) this command:

30 8 * * * root reboot

But is not working.
I tried this command aswell:

30 8 * * * root shutdown -r now

Can you help me out, please?

Thank you.

peterwkc
Posts: 8
Joined: 2015/11/02 12:17:24

Re: Crontab Reboot on CentOS 7

Post by peterwkc » 2015/11/02 12:29:12

Hi,

Have you inspected the cron log file and see what happening that may become the root cause of the problem?

Have you successfully executed other cron command?

giulix63
Posts: 1305
Joined: 2014/05/14 10:06:37
Location: UK

Re: Crontab Reboot on CentOS 7

Post by giulix63 » 2015/11/02 13:19:07

See crontab man pages for valid syntax and examples:

Code: Select all

man crontab
man 5 crontab
Also, errors should be emailed to you by crond. Type

Code: Select all

mail
in a terminal and press Return to read the mail (q to quit).
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.

Emma Taylor
Posts: 58
Joined: 2015/04/11 04:59:25
Location: United Kingdom

Re: Crontab Reboot on CentOS 7

Post by Emma Taylor » 2015/11/03 08:29:02

Hi,

Which control panel are you using?

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Crontab Reboot on CentOS 7

Post by TrevorH » 2015/11/03 13:54:17

Why would you do this anyway?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Crontab Reboot on CentOS 7

Post by aks » 2015/11/04 17:58:55

Probably wants the full path (so something like /sbin/reboot).

But yeah, don't do that....

mashkoorqadir
Posts: 70
Joined: 2012/06/27 07:55:01

Re: Crontab Reboot on CentOS 7

Post by mashkoorqadir » 2015/11/05 07:14:54

I am not sure that crontab can wake machines up. but you can try other ways. Such as
-you can wake a machine With a Magic packet
-you can set system with SRTC alarm to wake on the time.
-Most of machines have WOL option in BIOS you can set it to wake on scheduled time.
However you can shutdown your machine with crontab
let suppose you want to shutdown your machine at 5:30PM see the line below

30 17 * * * /sbin/shutdown -h now

save the crontab file and exit .

Post Reply