手动添加ubuntu服务
生活随笔
收集整理的這篇文章主要介紹了
手动添加ubuntu服务
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
在/etc/init.d/目錄下創(chuàng)建一個簡單的服務腳本,假設腳本名為hello
#!/bin/shcase "$1" in start)# start 的代碼;; stop)# stop 的代碼;; restart)# restart 的代碼;; *)echo "Usage: $0 {start|restart|stop}"exit 1;; esac第一行的"#!/bin/sh"一定要有, 否則有可能會報錯。
然后賦予hello可執(zhí)行權限,如:
chmod +x /etc/init.d/hello
如果執(zhí)行service hello時報錯: hello.service not found
則可能需要執(zhí)行一下:
update-rc.d hello defaults
這行腳本同時會將hello服務加入系統(tǒng)啟動執(zhí)行
轉(zhuǎn)載于:https://www.cnblogs.com/liuzhenwei/p/7928429.html
總結
以上是生活随笔為你收集整理的手动添加ubuntu服务的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Celery 启动报错 can_read
- 下一篇: mongodb之配置