记一次利用systemd服务
编写脚本sh.service 后缀service
$vim /root/auto_run_script.service
[Unit]
Description=Run a Custom Script at Startup
After=default.target
[Service]
ExecStart=/home/user/auto_start.sh
[Install]
WantedBy=default.target
拷贝到systemd目录
cp /root/auto_run_script.service /etc/systemd/systerm/
加权限
chmod 755 /etc/systemd/systerm/auto_run_script.service
配置脚本systemd自启
systemctl daemon-reload
systemctl enable auto_run_script.service
随后重启:
$reboot