Linux / Tips / other01


起動スクリプトテンプレート

注意

  • 終了処理 stop を動作させたい場合は以下の2行を有効にすること。
    # touch /var/lock/subsys/testscript
    # rm -f /var/lock/subsys/testscript

スクリプト

#!/bin/sh
#
# for testscript
#
# chkconfig: 99

# Source function library.
if [ -r /etc/init.d/functions ]; then
  . /etc/init.d/functions
elif [ -r /etc/rc.d/init.d/functions ]; then
  . /etc/rc.d/init.d/functions
else
  exit 1
fi

# function for start
start() {

    # touch /var/lock/subsys/testscript
}

# function for stop
stop() {
    # rm -f /var/lock/subsys/testscript
}

###
case "$1" in
  start)
	echo -n "calling testscript script: "

	start
	;;
  stop)
	stop
	;;
  status)
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: abem {start|stop|status|restart|reload}"
	exit 1
esac

exit 0

MenuBar


最新の20件

2015-05-15 2014-12-07 2008-11-17 2007-08-30 2007-04-21 2007-03-13 2007-03-12 2007-02-20 2007-02-14 2007-02-04 2006-11-26 2006-11-23 2006-11-20 2006-11-18 2006-11-13

  • counter: 315
  • today: 1
  • yesterday: 0
  • online: 1