歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 加載為服務:linux下自啟動文件的設置

加載為服務:linux下自啟動文件的設置

日期:2017/2/27 9:49:14   编辑:更多Linux
1.1 設置系統自動啟動

在/etc/init.d/下創建smsafe文件

內容:

#!/bin/bash

# chkconfig: 35 95 1

# description: script to start/stop smsafe

case $1 in

start)

sh /opt/startsms.sh

;;

stop)

sh /opt/stopsms.sh

;;

*)

echo "Usage: $0 (startstop)"

;;

esac

更改權限

# chmod 775 smsafe

加入自動啟動

# chkconfig –add smsafe

查看自動啟動設置

# chkconfig –list smsafe

smsafe 0:off 1:off 2:off 3:on 4:off 5:on 6:off

以後可以用以下命令啟動和停止腳本

# service smsafe start 啟動

# service smsafe stop 停止




Copyright © Linux教程網 All Rights Reserved