centos設定開機自啟動指令碼

2021-08-07 05:08:48 字數 620 閱讀 2815

以前直接在/etc/rc.local中寫入命令可執行,現在發現不起作用。

mount中內容

#!/bin/bash

#chkconfig: 2345 80 90

#description: mount

mount -t cifs -o username="administrator",password="***",uid=1002,gid=1002,file_mode=0777,dir_mode=0777 //*.*.*.*/vagrant2 /vagrant/

現在使用另外一種方法:

mv mount.sh /etc/rc.d/init.d/mount

chmod u+x /etc/rc.d/init.d/mount

新增服務

chkconfig --add mount

設定自啟動

chkconfig mount on

檢視自啟動項

chkconfig --list

reboot重啟檢視是否執行了mount服務

CentOS 開機自啟動指令碼

開機時執行自己的指令碼.1.編寫自己的服務指令碼 進入系統服務指令碼目錄 cd etc rc.d init.d vi test 內容如下 bin bash chkconfig 57 75 description test service start stop see how we were call...

CentOS 開機自啟動指令碼

開機時執行自己的指令碼.1.編寫自己的服務指令碼 進入系統服務指令碼目錄 cd etc rc.d init.d vi test 內容如下 bin bash chkconfig 57 75 description test service start stop see how we were call...

CentOS 開機自啟動指令碼

開機時執行自己的指令碼.1.編寫自己的服務指令碼 進入系統服務指令碼目錄 cd etc rc.d init.d vi test 內容如下 bin bash chkconfig 57 75 description test service start stop see how we were call...