網站首頁 編程語言 正文
在ubuntu 下創建服務及自啟動的方法:
1. 在 [/lib/systemd/system] 創建sandtable.service 服務,
[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. 創建啟動腳本
在[/etc]文件夾下創建sandtable啟動腳本,切記加上[腳本后&], 保證服務不影響系統啟動,不然那可能導致系統無法正常啟動后果。
#!/bin/sh /home/ubuntu/setup >> /home/ubuntu/test.log&
3. 啟動服務
systemctl start sandtable.service #啟動服務 systemctl status sandtable.service #查看服務是否啟動 systemctl enable sandtable.service #開機運行服務 systemctl is-enabled sandtable.service #查詢服務是否開機啟動
4 服務常用命令
systemctl is-enabled servicename.service #查詢服務是否開機啟動 systemctl enable *.service #開機運行服務 systemctl disable *.service #取消開機運行 systemctl start *.service #啟動服務 systemctl stop *.service #停止服務 systemctl restart *.service #重啟服務 systemctl reload *.service #重新加載服務配置文件 systemctl status *.service #查詢服務運行狀態
5.桌面系統的開啟與關閉
// 關閉桌面系統 sudo systemctl set-default multi-user.target sudo reboot // 打開桌面系統 sudo systemctl set-default graphical.target sudo reboot
6. 桌面版設置的wifi 在下邊路徑進行修改替換即可
/etc/NetworkManager/system-connections
原文鏈接:https://blog.csdn.net/qq_31329259/article/details/122174377
相關推薦
- 2022-06-07 Python中的引用和拷貝規律詳解_python
- 2022-09-17 Python高效處理大文件的方法詳解_python
- 2022-09-28 Linux在兩個服務器直接傳文件的操作方法_Linux
- 2022-07-08 Python設置Word全局樣式和文本樣式的示例代碼_python
- 2022-09-30 Ajax實現關鍵字聯想和自動補全功能及遇到坑_AJAX相關
- 2022-02-03 checkbox修改默認樣式
- 2023-08-13 fastadmin框架中如何添加一個自定義按鈕
- 2022-05-02 C/C++的各種字符串函數你知道幾個_C 語言
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支