久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

ubuntu開機(jī)自啟動服務(wù)設(shè)置

瀏覽:187日期:2023-03-07 14:40:10

在ubuntu 下創(chuàng)建服務(wù)及自啟動的方法:

1. 在 [/lib/systemd/system] 創(chuàng)建sandtable.service 服務(wù),

[Unit]
Description=/etc/sandtable Compatibility
Documentation=man:systemd-sandtable-generator(8)
ConditionFileIsExecutable=/etc/sandtable
After=network.target
 
[Service]
Type=forking
ExecStart=/etc/sandtable start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
 
[Install]
WantedBy=multi-user.target  
Alias=sandtable.service

2. 創(chuàng)建啟動腳本

在[/etc]文件夾下創(chuàng)建sandtable啟動腳本,切記加上[腳本后&], 保證服務(wù)不影響系統(tǒng)啟動,不然那可能導(dǎo)致系統(tǒng)無法正常啟動后果。

#!/bin/sh
/home/ubuntu/setup >> /home/ubuntu/test.log&

3. 啟動服務(wù)

systemctl start sandtable.service #啟動服務(wù)
 
systemctl status sandtable.service #查看服務(wù)是否啟動
 
systemctl enable sandtable.service #開機(jī)運(yùn)行服務(wù)
 
systemctl is-enabled sandtable.service #查詢服務(wù)是否開機(jī)啟動

4 服務(wù)常用命令

systemctl is-enabled servicename.service #查詢服務(wù)是否開機(jī)啟動
 
systemctl enable *.service #開機(jī)運(yùn)行服務(wù)
 
systemctl disable *.service #取消開機(jī)運(yùn)行
 
systemctl start *.service #啟動服務(wù)
 
systemctl stop *.service #停止服務(wù)
 
systemctl restart *.service #重啟服務(wù)
 
systemctl reload *.service #重新加載服務(wù)配置文件
 
systemctl status *.service #查詢服務(wù)運(yùn)行狀態(tài)

5.桌面系統(tǒng)的開啟與關(guān)閉

// 關(guān)閉桌面系統(tǒng)
sudo systemctl set-default multi-user.target
sudo reboot
 
// 打開桌面系統(tǒng)
sudo systemctl set-default graphical.target
sudo reboot

6. 桌面版設(shè)置的wifi 在下邊路徑進(jìn)行修改替換即可

 /etc/NetworkManager/system-connections

到此這篇關(guān)于ubuntu開機(jī)自啟動服務(wù)設(shè)置的文章就介紹到這了,更多相關(guān)ubuntu開機(jī)自啟動內(nèi)容請搜索以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持!

標(biāo)簽: Linux Apache
主站蜘蛛池模板: 田东县| 台南市| 敦化市| 湟源县| 宿松县| 舒城县| 泰和县| 台安县| 霸州市| 平泉县| 迁安市| 景洪市| 焦作市| 依安县| 延川县| 渝北区| 金寨县| 安多县| 黄冈市| 雅安市| 灵寿县| 浦江县| 曲靖市| 新巴尔虎左旗| 栖霞市| 泾阳县| 长宁县| 类乌齐县| 林西县| 东阿县| 土默特左旗| 眉山市| 横山县| 澳门| 灵台县| 滦南县| 屏东市| 洛南县| 禹城市| 新昌县| 太原市|