ubuntu注册程序为服务
ubuntu注册程序为服务
ubuntu服务存放路径
/etc/systemd/system/myservice.service
服务文件配置
1
2
3
4
5
6
7
8
9
10
[Unit]
Description=This is myservice
[Service]
Type=simple
ExecStart=/bin/bash -c '/usr/bin/python /home/test.py'
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动服务
sudo systemctl start myservice.service
服务开机自启
sudo systemctl enable myservice.service
This post is licensed under CC BY 4.0 by the author.