搜索文档
写开机自启服务文件:
sudo vim /lib/systemd/system/test.service
写入以下内容:
[Unit] Description=Test Service After=multi-user.target [Service] User=uos Group=uos Type=idle WorkingDirectory=/home/uos/ocr_env ExecStart=$do you shell scripts$ [Install] WantedBy=multi-user.target
注意,在 ExecStart=$do you shell scripts$ 里面配置你的要执行的命令,比如:ExecStart=bash test.sh
ExecStart=$do you shell scripts$
ExecStart=bash test.sh
修改配置文件的权限:
sudo chmod 644 /lib/systemd/system/test.service
自启服务生效:
sudo systemctl daemon-reload sudo systemctl enable test.service
查看服务状态:
sudo systemctl status test.service