程序的工作目录:

helloworld设置成开机自启动的服务

涉及的几个文件:

helloworld设置成开机自启动的服务

程序源代码:

helloworld设置成开机自启动的服务

启动脚本和停止脚本的内容:

helloworld设置成开机自启动的服务

helloworld设置成开机自启动的服务

服务配置文件:

helloworld设置成开机自启动的服务

 

该服务启动后,具有异常退出后自动重启功能。

systemctl enable test :开机自动启动。

systemctl disable test:开机不自动启动。

systemctl start test :启动服务

systemctl stop test :停止服务

 

注意事项:

1.文件中设计的各种路径要正确无误。

2.脚本文件要增加可执行属性。

3.否者报错!

 

 

 

 

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2021-06-30
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案