赞
踩
内容如下:
[Unit]
Description=Files Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/xxx/xxxxx.py
[Install]
WantedBy=multi-user.target
定义了一个叫Files Service的服务,ExecStart参数指定我们要运行的程序
更改配置文件的权限:sudo chmod 644 /lib/systemd/system/autorun.service
使配置文件生效:sudo systemctl daemon-reload
sudo systemctl enable autorun.service
启动服务:systemctl start autorun.service
查看服务状态:systemctl status autorun.service
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。