Home  >  Article  >  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

小云云
小云云Original
2018-01-09 09:46:382321browse

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

Example description (only in Runs from Monday to Friday)

1 15 23 * * 1-5 /sbin/shutdown -h now

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

15 23 * * 1-5 root shutdown -h now

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

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

# ethtool -s eth0 wol g

3. Add cron to ensure that g

@reboot /usr/bin/ethtool -s eth0 wol g

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!

Statement:
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