cron job restart machine on 5:30am and startup on 7:59am every Sunday

General support questions
Post Reply
kkwok
Posts: 4
Joined: 2019/07/05 08:12:30

cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by kkwok » 2019/07/05 08:30:23

I have create the cron job restart machine on 5:30am and startup on 7:59am every Sunday, so that the server keep hanging 2 hours and 29 minutes.
But I tried to enter" reboot" command is normal reboot immediately.

Cron job Log:
May 26 05:01:01 abcserver run-parts(/etc/cron.hourly)[941]: finished mcelog.cron
May 26 05:10:01 abcserver CROND[2325]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May 26 05:20:01 abcserver CROND[3888]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May 26 05:30:01 abcserver CROND[5450]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May 26 05:30:01 abcserver CROND[5451]: (root) CMD (/sbin/reboot)
May 26 05:30:01 abcserver crond[1200]: (CRON) INFO (Shutting down)
May 26 07:59:45 abcserver crond[1238]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 55% if used.)
May 26 07:59:45 abcserver crond[1238]: (CRON) INFO (running with inotify support)
May 26 07:59:45 abcserver CROND[1328]: (root) CMD (echo "Server has restarted "`hostname` | mail -s "System Restart" edf@xxxx.com)
May 26 07:59:45 abcserver CROND[1327]: (root) CMD (echo "Server has restarted "`hostname` | mail -s "System Restart" abc@xxxx.com)
May 26 08:00:02 abcserver CROND[1552]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May 26 08:01:01 abcserver CROND[1699]: (root) CMD (run-parts /etc/cron.hourly)
May 26 08:01:01 abcserver run-parts(/etc/cron.hourly)[1699]: starting 0anacron
May 26 08:01:01 abcserver run-parts(/etc/cron.hourly)[1708]: finished 0anacron
May 26 08:01:01 abcserver run-parts(/etc/cron.hourly)[1699]: starting mcelog.cron
May 26 08:01:01 abcserver run-parts(/etc/cron.hourly)[1714]: finished mcelog.cron

Message Log:
May 26 05:30:01 abcserver systemd: Created slice User Slice of root.
May 26 05:30:01 abcserver systemd: Starting User Slice of root.
May 26 05:30:01 abcserver systemd: Started Session 9133 of user root.
May 26 05:30:01 abcserver systemd: Starting Session 9133 of user root.
May 26 05:30:01 abcserver systemd: Started Session 9134 of user root.
May 26 05:30:01 abcserver systemd: Starting Session 9134 of user root.
May 26 05:30:01 abcserver systemd: Stopped Session 9134 of user root.
May 26 05:30:01 abcserver systemd: Stopping Availability of block devices...
May 26 05:30:01 abcserver systemd: Stopping Manage Sound Card State (restore and store)...
May 26 05:30:01 abcserver systemd: Stopping Session 9133 of user root.
May 26 05:30:01 abcserver alsactl[804]: /usr/sbin/alsactl: save_state:1595No soundcards found...
May 26 05:30:01 abcserver systemd: Stopping LVM2 PV scan on device 8:2...
May 26 05:30:01 abcserver alsactl[804]: alsactl daemon stopped
May 26 05:30:01 abcserver systemd: Unmounting RPC Pipe File System...
May 26 05:30:01 abcserver systemd: Stopped Dump dmesg to /var/log/dmesg.
May 26 05:30:01 abcserver systemd: Stopping Dump dmesg to /var/log/dmesg...
May 26 05:30:01 abcserver systemd: Stopping Authorization Manager...
May 26 05:30:01 abcserver systemd: Stopping PackageKit Daemon...
May 26 05:30:01 abcserver systemd: Stopped target Timers.
May 26 05:30:01 abcserver systemd: Stopping Timers.
May 26 05:30:01 abcserver systemd: Stopped Daily Cleanup of Temporary Directories.
May 26 05:30:01 abcserver systemd: Stopping Daily Cleanup of Temporary Directories.
May 26 05:30:01 abcserver ModemManager[783]: <info> Caught signal, shutting down...
May 26 05:30:01 abcserver systemd: Stopped target Multi-User System.
May 26 07:59:27 abcserver kernel: Initializing cgroup subsys cpuset
May 26 07:59:27 abcserver kernel: Initializing cgroup subsys cpu
May 26 07:59:27 abcserver kernel: Initializing cgroup subsys cpuacct
May 26 07:59:27 abcserver kernel: Linux version 3.10.0-693.5.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017
May 26 07:59:27 abcserver kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-693.5.2.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8
May 26 07:59:27 abcserver kernel: Disabled fast string operations
May 26 07:59:27 abcserver kernel: e820: BIOS-provided physical RAM map:

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by tunk » 2019/07/05 12:53:02

Don't think that will work, when it's off, it is off.
You could look at Wake on Lan (never used it, so don't ask), or maybe use a 110/230V weekly timer.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by hunter86_bg » 2019/07/05 13:27:47

Set shutdown via cron and power up via BIOS (if you have such option.

otherwise you can set it to sleep and wake it up via magic packet over ethernet ( if there is router - it won't happen).

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

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by TrevorH » 2019/07/05 14:50:00

May 26 07:59:27 abcserver kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-693.5.2.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8
Run yum update as your system is extremely out of date - it's stil running a 7.4 kernel and the current version is 7.6.

I'd also suggest removing rhgb quiet from the kernel command line if you are having problems that might be kernel related.
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

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by lightman47 » 2019/07/05 21:48:04

Don't think that will work, when it's off, it is off.
You could look at Wake on Lan (never used it, so don't ask), or maybe use a 110/230V weekly timer.
When the machine is 'off', CentOS isn't running to 'wake it up' - I use W.O.L. (ether-wake xx:xx:xx:xx:xx:xx) on multiple machines regularly; it works great (until one of them is powered-off by the power button or a power outage and then requires the power button to start it again)

As hunter86_bg mentions, using the BIOS wake-up function may also be of help you.

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

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by TrevorH » 2019/07/05 22:00:48

I think the OP is asking why his cronjob is set to run at 05:30 on a Sunday but it then doesn't seem to restart until 07:59 and he wants to know what it was doing for 2.5 hours. There are many ways of reading the problem description and I am not entirely sure that I have it right or if anyone else does either come to that :-)
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

kkwok
Posts: 4
Joined: 2019/07/05 08:12:30

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by kkwok » 2019/07/08 01:53:44

TrevorH wrote:
2019/07/05 22:00:48
I think the OP is asking why his cronjob is set to run at 05:30 on a Sunday but it then doesn't seem to restart until 07:59 and he wants to know what it was doing for 2.5 hours. There are many ways of reading the problem description and I am not entirely sure that I have it right or if anyone else does either come to that :-)
Yes, the 2.5 hours is keep waiting, we cannot ping the server....until to reboot the server after 2.5 hours ....

kkwok
Posts: 4
Joined: 2019/07/05 08:12:30

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by kkwok » 2019/07/08 03:37:45

tunk wrote:
2019/07/05 12:53:02
Don't think that will work, when it's off, it is off.
You could look at Wake on Lan (never used it, so don't ask), or maybe use a 110/230V weekly timer.
Oh...this is VM, not it physical server..><"

kkwok
Posts: 4
Joined: 2019/07/05 08:12:30

Re: cron job restart machine on 5:30am and startup on 7:59am every Sunday

Post by kkwok » 2019/07/08 03:39:48

TrevorH wrote:
2019/07/05 14:50:00
May 26 07:59:27 abcserver kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-693.5.2.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8
Run yum update as your system is extremely out of date - it's stil running a 7.4 kernel and the current version is 7.6.

I'd also suggest removing rhgb quiet from the kernel command line if you are having problems that might be kernel related.
Yes, I try to upgrade to kernel....Thanks.

Post Reply