suse linux设置开启自启动

#!/bin/sh

# chkconfig: 2345 64 36   

# description: A very fast and reliable nginx database engine. 

# Comments to support LSB init script conventions

### BEGIN INIT INFO

# Provides: nginx                                 

# Required-Start: $local_fs $network $remote_fs     

# Should-Start: ypbind nscd ldap ntpd xntpd         

# Required-Stop: $local_fs $network $remote_fs     

# Default-Start:  2 3 4 5                     

# Default-Stop: 0 1 6                       

# Short-Description: start and stop nginx   

# Description: nginx is a very fast and reliable nginx database engine.

### END INIT INFO

. /etc/rc.status   

rc_reset

case "$1" in

    start)

          echo -n "Starting nginx "

          su - root -c "cd /usr/local/nginx; sbin/nginx"

          rc_status -v

        ;;

    stop)

          echo -n "Shutting down nginx "

          su - root -c "cd /usr/local/nginx;  sbin/nginx -s stop"

          rc_status -v

        ;;

    restart)

          $0 stop

          $0 start

          rc_status

        ;;

    status)

      id=`lsof -i:9081 | awk '{print $2}'`

      if [ -z $id ];then

            echo "service  unused"

      else

            echo $id

      fi

          rc_status -v

        ;;

    *)

          echo "Usage: $0 {start|stop|status|restart}"

          exit 1

        ;;

esac

rc_exit

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容