Home > Operation and Maintenance > Linux Operation and Maintenance > About how to implement automatic wake-up and shutdown in Linux

About how to implement automatic wake-up and shutdown in Linux

小云云
Release: 2018-01-09 09:46:38
Original
2419 people have browsed it

I don’t know how much you understand about Linux automatic wake-up and shutdown. This article mainly introduces the implementation method of Linux automatic wake-up and shutdown. Friends who need it can refer to it. I hope it can help everyone.

1. System hibernation (crontab)

Example description (create a root scheduled task to implement scheduled shutdown at 11:15 every night):

# crontab -e -u root
 # m h dom mon dow  command
15 23 * * * /sbin/shutdown -h now
Copy after login

Example description (only in Runs from Monday to Friday)

1 15 23 * * 1-5 /sbin/shutdown -h now
Copy after login

In addition, you can add a scheduled service directly in the /etc/crontab file

15 23 * * 1-5 root shutdown -h now
Copy after login

2. Wake-On-LAN

 1 . Check whether Wake-On-LAN is enabled directly. The function that must be supported is g

# ethtool eth0 | grep -i wake-on
 Supports Wake-on: pumbg
 Wake-on: g
Copy after login

2. Start g (ps: this command may become invalid after restarting)

# ethtool -s eth0 wol g
Copy after login

3. Add cron to ensure that g

@reboot /usr/bin/ethtool -s eth0 wol g
Copy after login

has been learned after each restart? Hurry up and try it out.

Related recommendations:

Teach you how to set up the server to automatically restart using Linux

Linux expect installation tutorial

Commonly used operating commands in linux

The above is the detailed content of About how to implement automatic wake-up and shutdown in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template