Linux中service命令和/etc/init.d/的關系


Linux中service命令和/etc/init.d/的關系
 
service xxx啟動 /etc/init.d/ 目錄下的xxx腳本
如一個腳本名為 mys vc保存在/etc/init.d/下可以用 service mysvc 運行mysvc腳本
echo passed in option $0 $1
 
if [ $1 = "start" ]
then
        echo myservice started........................................
elif [ $1 = "stop" ]
then
        echo myservice stoped........................................
else
        echo myservice not supported option........................................
fi  www.2cto.com  
 
[root@localhost init.d]# service mysvc start
passed in option /etc/init.d/mysvc start
myservice started........................................
 
[root@localhost init.d]# service mysvc stop
passed in option /etc/init.d/mysvc stop
myservice stoped........................................
 
[root@localhost init.d]# service mysvc xxx
passed in option /etc/init.d/mysvc xxx
myservice not supported option........................................


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM