当前位置:操作系统 > Unix/Linux >>

加载为服务: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 (start|stop)"

  ;;

  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 © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,