在ubuntu 下創(chuàng)建服務及自啟動的方法:
1. 在 [/lib/systemd/system] 創(chuàng)建sandtable.service 服務,
[Unit]Description=/etc/sandtable CompatibilityDocumentation=man:systemd-sandtable-generator(8)ConditionFileIsExecutable=/etc/sandtableAfter=network.target [Service]Type=forkingExecStart=/etc/sandtable startTimeoutSec=0RemainAfterExit=yesGuessMainPID=no [Install]WantedBy=multi-user.targetAlias=sandtable.service2. 創(chuàng)建啟動腳本
在[/etc]文件夾下創(chuàng)建sandtable啟動腳本,切記加上[腳本后&], 保證服務不影響系統(tǒng)啟動,不然那可能導致系統(tǒng)無法正常啟動后果 。
#!/bin/sh/home/ubuntu/setup >> /home/ubuntu/test.log&3. 啟動服務
【ubuntu系統(tǒng)設置開機自啟動服務】systemctl start sandtable.service #啟動服務 systemctl status sandtable.service #查看服務是否啟動 systemctl enable sandtable.service #開機運行服務 systemctl is-enabled sandtable.service #查詢服務是否開機啟動
推薦閱讀
- shell腳本設置防止暴力破解ssh
- 華為二合一平板電腦 怎么設置指紋
- 系統(tǒng)桌面:一個桌面系統(tǒng),兩個桌面空間
- 桌面壁紙自動更換
- 架構師如何設計架構,如何設置公司架構
- 教你5步把系統(tǒng)盤遷移至SSD,如何把系統(tǒng)裝到u盤 做成移動系統(tǒng)
- 手機怎么設置假關機,關機拔卡還能被定位
- XP系統(tǒng)下小米5,小米5sp解鎖全4g頻段
- 通達OA辦公系統(tǒng)標準解決方案 oa辦公系統(tǒng)用什么瀏覽器
- 手機號定位查詢系統(tǒng)免費平臺 壹號標記查詢系統(tǒng)
