網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
在ubuntu 下創(chuàng)建服務(wù)及自啟動(dòng)的方法:
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)建啟動(dòng)腳本
在[/etc]文件夾下創(chuàng)建sandtable啟動(dòng)腳本,切記加上[腳本后&], 保證服務(wù)不影響系統(tǒng)啟動(dòng),不然那可能導(dǎo)致系統(tǒng)無(wú)法正常啟動(dòng)后果。
#!/bin/sh /home/ubuntu/setup >> /home/ubuntu/test.log&
3. 啟動(dòng)服務(wù)
systemctl start sandtable.service #啟動(dòng)服務(wù) systemctl status sandtable.service #查看服務(wù)是否啟動(dòng) systemctl enable sandtable.service #開(kāi)機(jī)運(yùn)行服務(wù) systemctl is-enabled sandtable.service #查詢服務(wù)是否開(kāi)機(jī)啟動(dòng)
4 服務(wù)常用命令
systemctl is-enabled servicename.service #查詢服務(wù)是否開(kāi)機(jī)啟動(dòng) systemctl enable *.service #開(kāi)機(jī)運(yùn)行服務(wù) systemctl disable *.service #取消開(kāi)機(jī)運(yùn)行 systemctl start *.service #啟動(dòng)服務(wù) systemctl stop *.service #停止服務(wù) systemctl restart *.service #重啟服務(wù) systemctl reload *.service #重新加載服務(wù)配置文件 systemctl status *.service #查詢服務(wù)運(yùn)行狀態(tài)
5.桌面系統(tǒng)的開(kāi)啟與關(guān)閉
// 關(guān)閉桌面系統(tǒng) sudo systemctl set-default multi-user.target sudo reboot // 打開(kāi)桌面系統(tǒng) sudo systemctl set-default graphical.target sudo reboot
6. 桌面版設(shè)置的wifi 在下邊路徑進(jìn)行修改替換即可
/etc/NetworkManager/system-connections
原文鏈接:https://blog.csdn.net/qq_31329259/article/details/122174377
相關(guān)推薦
- 2023-11-20 python設(shè)置matplotlib.plot的坐標(biāo)刻度和坐標(biāo)范圍
- 2022-07-10 初識(shí)form表單中的兩種提交方式
- 2022-08-15 Redis緩存三大異常的處理方案梳理總結(jié)_Redis
- 2023-07-16 uniapp 調(diào)用拍照組件
- 2023-02-15 react源碼合成事件深入解析_React
- 2024-01-05 【PostgreSQL啟動(dòng),停止命令(重啟)】
- 2023-01-01 Android?webView加載數(shù)據(jù)時(shí)內(nèi)存溢出問(wèn)題及解決_Android
- 2023-01-06 Flutter?Recovering?Stream?Errors小技巧_Android
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支