*** Cent OS の /etc/init.d/yum の内容 [#h1dd1c75]

 [root@spirit init.d]# cat yum
 #!/bin/bash
 #
 # yum           This shell script enables the automatic use of YUM
 #
 # Author:       Seth Vidal <skvidal@phy.duke.edu>
 #
 # chkconfig:    - 50 01
 #
 # description:  Enable daily run of yum, a program updater.
 # processname:  yum
 # config: /etc/yum.conf
 # 
 
 # source function library
 . /etc/rc.d/init.d/functions 
 
 lockfile=/var/lock/subsys/yum 
 
 RETVAL=0 
 
 start() {
         echo -n $"Enabling nightly yum update: "
         touch "$lockfile" && success || failure
         RETVAL=$?
         echo
 } 
 
 stop() {
         echo -n $"Disabling nightly yum update: "
         rm -f "$lockfile" && success || failure
         RETVAL=$?
         echo
 }
 
 restart() {
         stop
         start
 }
 
 case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   restart|force-reload)
         restart
         ;;
   reload)
         ;;
   condrestart)
         [ -f "$lockfile" ] && restart
         ;;
   status)
         if [ -f $lockfile ]; then
                 echo $"Nightly yum update is enabled."
                 RETVAL=0
         else
                 echo $"Nightly yum update is disabled."
                 RETVAL=3
         fi
         ;;
   *)
         echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
         exit 1
 esac
 
 exit $RETVAL
*** 他のサイトからの引用 [#hb73270a]
 #!/bin/bash
 # chkconfig: 345 80 20
 # description: Clamd DAEMON
 . /etc/init.d/functions
 prog="/usr/sbin/clamd"
 prog_base="$(basename ${prog})"
 prog_config_file="/etc/clamd.conf"
 RETVAL=0 
 
 # See how we were called.
 case "$1" in
   start)
     action $"Starting ${prog_base}:" ${prog} -c ${prog_config_file}
     RETVAL=$?
     echo
     ;;
   stop)
     echo $"Shutting down ${prog_base}"
     killproc ${prog_base} 
     RETVAL=$?
     echo
     ;;
   status)
     status $"${prog_base}"
     RETVAL=$?
     echo
     ;;
   restart)
     $0 stop
     $0 start
     RETVAL=$?
     ;;
   reload)
     pid=`pidofproc ${prog_base}`
     kill -USR2 ${pid}
     RETVAL=$?
     ;;
   *)
     echo "Usage: $0 {start|stop|status|restart|reload}"
     exit 1
 esac
 
 exit $RETVAL

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS