ubuntu创建开机启动服务
【摘要】 1.chmod +x /home/user***/pythonProject/dist/xxx //为应用加权限2.nano /etc/systemd/system/应用名.service //xxx.service文件[Unit]Description=xxxAfter=basic.service[Service]Type=oneshotKillMode=control-g...
1.chmod +x /home/user***/pythonProject/dist/xxx //为应用加权限
2.nano /etc/systemd/system/应用名.service //xxx.service文件
[Unit]
Description=xxx
After=basic.service
[Service]
Type=oneshot
KillMode=control-group
ExecStart=/home/user***/pythonProject/dist/xxx
[Install]
Alias=xxx.service
WantedBy=multi-user.target
3.chmod +x /etc/systemd/system/xxx.service //为.service文件添加执行权限
4.systemctl daemon-reload //重载系统服务
5.systemctl enable svc-test.service //将服务注册为开机启动(默认已经是开机启动,不用单独注册)
systemctl disable svc-test.service //
6.
systemctl status
systemctl status svc-test
systemctl stop svc-test、
systemctl start svc-test
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
热门文章
评论(0)