Changeset 59 for trunk/init
- Timestamp:
- Aug 31, 2006, 9:25:02 PM (18 years ago)
- Location:
- trunk/init
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/init/samhain.startFreeBSD.in
r1 r59 1 #! /bin/sh - 1 #!/bin/sh 2 3 # PROVIDE: @install_name@ 4 # REQUIRE: LOGIN 5 # KEYWORD: shutdown 6 7 . /etc/rc.subr 8 9 name="@install_name@" 10 rcvar=`set_rcvar` 11 12 pidfile="@mylockfile@" 13 14 # there are no required_files in general, 15 # as they might be downloaded from the server 2 16 # 3 # initialization/shutdown script for @install_name@ package17 # required_files="@myconffile@ @mydatafile@" 4 18 5 prefix="@prefix@"6 exec_prefix="@exec_prefix@"19 extra_commands="reload" 20 stop_postcmd="remove_stale_files" 7 21 8 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 9 DAEMON=@sbindir@/@install_name@ 10 NAME=@install_name@ 11 pidfile=@mylockfile@ 22 command="@sbindir@/@install_name@" 12 23 13 test -f $DAEMON || exit 0 14 15 safe_pidof () { 16 pidval=0 17 if [ -f $pidfile ] ; then 18 pidval=`cat $pidfile | awk '{ print $1 }'` 19 echo "${pidval}" | grep ['[^0123456789]'] >/dev/null 2>&1 && pidval=0 20 fi 21 echo $pidval 22 if [ x"$pidval" = x0 ] ; then 23 return 1 24 else 25 return 0 26 fi 24 is_set() 25 { 26 eval "[ -n \"\${$1+X}\" ]" 27 27 } 28 28 29 log_stat_msg () { 30 case "$1" in 31 0) 32 echo "Service $NAME: Running"; 33 break; 34 ;; 35 1) 36 echo "Service $NAME: Stopped and @mylockfile@ pid file exists"; 37 break; 38 ;; 39 3) 40 echo "Service $NAME: Stopped"; 41 break; 42 ;; 43 *) 44 echo "Service $NAME: Status unknown"; 45 break; 46 ;; 47 esac 29 remove_stale_files() 30 { 31 if test -f @mylockfile@; then 32 /bin/rm -f @mylockfile@ 33 fi 34 /bin/rm -f @mylockdir@/${name}.sock 48 35 } 49 36 50 case "$1" in 51 start) 52 # 53 # Remove a stale lockfile, if found 54 # 55 if test -f @mylockfile@; then 56 rm -f @mylockfile@ 57 fi 58 /bin/rm -f @mylockdir@/${NAME}.sock 59 $DAEMON -D && echo -n " $NAME" 60 ;; 61 stop) 62 PID=`safe_pidof` 63 if test "x$PID" != x0 64 then 65 kill $PID && echo -n " $NAME" 66 fi 67 ;; 68 reload|force-reload) 69 PID=`safe_pidof` 70 if test "x$PID" != x0 71 then 72 echo " Reloading $NAME configuration file." 73 kill -s HUP $PID && echo -n " $NAME" 74 else 75 echo " Cannot determine PID of process $NAME." 76 exit 1 77 fi 78 ;; 79 restart) 80 $0 stop 81 sleep 3 82 $0 start 83 ;; 84 status) 85 $DAEMON status 86 ERRNUM=$? 87 log_stat_msg ${ERRNUM} 88 exit ${ERRNUM} 89 ;; 90 *) 91 echo " Usage: $0 {start|stop|restart|reload|force-reload}" >&2 92 exit 1 93 ;; 94 esac 37 load_rc_config "$name" 95 38 39 if ! is_set ${rcvar}; then 40 eval "${rcvar}=YES" 41 fi 42 43 run_rc_command "$1" 44 -
trunk/init/samhain.startLinux.in
r1 r59 63 63 fi 64 64 65 function debian_end()65 debian_end() 66 66 { 67 67 if [ $RETVAL -eq 0 ]; … … 103 103 104 104 # echo OK in green if is success, FAILED in red is failed 105 function generic_end()105 generic_end() 106 106 { 107 107 if [ $RETVAL -eq 0 ]; -
trunk/init/samhain.startSolaris.in
r1 r59 9 9 10 10 11 log_stat_msg 11 log_stat_msg() { 12 12 case "$1" in 13 13 0)
Note:
See TracChangeset
for help on using the changeset viewer.