Skip to content

Instantly share code, notes, and snippets.

@cn27529
Last active August 27, 2020 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cn27529/58e6d84550819740eac1dfe568ef9c09 to your computer and use it in GitHub Desktop.
Save cn27529/58e6d84550819740eac1dfe568ef9c09 to your computer and use it in GitHub Desktop.
# 1.sudo su 切換到root權限
# 2.以root身分, 進入lib/systemd/system/ 查看是否有rc.local.service檔案, 一般都會有啦XD
若沒有就走2-1
## 2-1.nano lib/systemd/system/rc.local.service
在文件中最後加上
[Install]
WantedBy=multi-user.target
Alias=rc.local.service
將rc.local.service存檔離開
# 3.去etc/下建立 rc.local 檔
cd /etc
sudo touch rc.local
nano rc.local
填入內容如下
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#每次啟動自動執行Glances 命令列系統監控工具
glances -w
exit 0
4.rc.local 變更執行權限
sudo chmod +R 777 /etc/rc.local
5.啟用服務
sudo systemctl enable rc.local.service
6.重開機如果有自動glances -w就是成功囉!
參考
https://www.webteach.tw/?p=2621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment