我是靠谱客的博主 友好星星,这篇文章主要介绍ubuntu设置程序开机自启动,现在分享给大家,希望可以做个参考。

1. 在 /lib/systemd/system 创建 service 文件

sudo vim /lib/systemd/system/my_first.service

 [Unit]
Description=my_first service
After=network.target network-online.target syslog.target
Wants=network.target network-online.target

[Service]
Type=simple


ExecStart=/your/path/my_first -c /your/path/my_first_param

[Install]
WantedBy=multi-user.target

2. 启动

sudo systemctl start my_first 

3.设置自启动

 sudo systemctl enable my_first

4. 启动、停止、重启

 sudo systemctl start my_first

sudo systemctl stop my_first

sudo systemctl restart my_first

最后

以上就是友好星星最近收集整理的关于ubuntu设置程序开机自启动的全部内容,更多相关ubuntu设置程序开机自启动内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部