Changeset 59 for trunk/init


Ignore:
Timestamp:
Aug 31, 2006, 9:25:02 PM (18 years ago)
Author:
rainer
Message:

Fix for exit status if database load fails; fix for problem with GrowingLogFiles if signed database is used; better support for *BSD init script installation.

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
     9name="@install_name@"
     10rcvar=`set_rcvar`
     11
     12pidfile="@mylockfile@"
     13
     14# there are no required_files in general,
     15# as they might be downloaded from the server
    216#
    3 #    initialization/shutdown script for @install_name@ package
     17# required_files="@myconffile@ @mydatafile@"
    418
    5 prefix="@prefix@"
    6 exec_prefix="@exec_prefix@"
     19extra_commands="reload"
     20stop_postcmd="remove_stale_files"
    721
    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@
     22command="@sbindir@/@install_name@"
    1223
    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
     24is_set()
     25{
     26    eval "[ -n \"\${$1+X}\" ]"
    2727}
    2828
    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
     29remove_stale_files()
     30{
     31    if test -f @mylockfile@; then
     32        /bin/rm -f @mylockfile@
     33    fi
     34    /bin/rm -f @mylockdir@/${name}.sock
    4835}
    4936
    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
     37load_rc_config "$name"
    9538
     39if ! is_set ${rcvar}; then
     40    eval "${rcvar}=YES"
     41fi
     42
     43run_rc_command "$1"
     44
  • trunk/init/samhain.startLinux.in

    r1 r59  
    6363fi
    6464
    65 function debian_end ()
     65debian_end()
    6666{
    6767        if [ $RETVAL -eq 0 ];
     
    103103
    104104# echo OK in green if is success, FAILED in red is failed
    105 function generic_end ()
     105generic_end()
    106106{
    107107        if [ $RETVAL -eq 0 ];
  • trunk/init/samhain.startSolaris.in

    r1 r59  
    99
    1010
    11 log_stat_msg () {
     11log_stat_msg() {
    1212case "$1" in
    1313        0)
Note: See TracChangeset for help on using the changeset viewer.