> A scan is triggered only if robinhood daemon is started with --scan option.
> Check your configuration, init script and init config file (probably 
> /etc/sysconfig/robinhood)

This is not what I observe :/

Here is the situation:

$ ps faux|grep -e [r]bh -e [r]obinhood
root      2087 15.8  7.9 1779924 640524 ?      Ssl  Jul05 422:49
/usr/sbin/robinhood -d -f /etc/robinhood.d/tmpfs/atlas_projets.conf -p
/var/run/rbh.atlas_projets

$ rbh-report -a
...
    Last filesystem scan:
            status:          done
            start:           2014/07/05 13:57:07
            end:             2014/07/06 19:17:52
            duration:        1d 5h 20min 45s
...

$ cat /etc/sysconfig/robinhood
# directory of configuration files for this service
#RH_CONF_DIR=/etc/robinhood.d/tmpfs
# current directory where the daemon is started
#RH_RUN_DIR=/
# path to robinhood command
#DAEMON=/usr/sbin/robinhood

# options for starting the daemon
# eg. --scan --purge (leave empty for default actions).
RBH_OPT=""


Let's stop the robinhood service:

$ sudo /etc/init.d/robinhood stop
Stopping Robinhood for /etc/robinhood.d/tmpfs/atlas_projets[  OK  ].
Checking process status ...                                [  OK  ]

$ ps faux|grep -e [r]bh -e [r]obinhood
$

We start it again:

$ /etc/init.d/robinhood start
Starting Robinhood for /etc/robinhood.d/tmpfs/atlas_projets.conf  [  OK  ]
Checking process status...                                        [  OK  ]

$ ps faux|grep -e [r]bh -e [r]obinhood
root     11084  3.3  2.5 1273524 203104 ?      Ssl  10:25   0:01
/usr/sbin/robinhood -d -f /etc/robinhood.d/tmpfs/atlas_projets.conf -p
/var/run/rbh.atlas_projets

But when I look at the rbh-report -a output, a scan has been trigerred :

$ rbh-report -a
....
Last filesystem scan:
            status:          running
            start:           2014/07/07 10:25:29 (59s ago)
            last action:     2014/07/07 10:25:29 (59s ago)

I'm using the init script from the rpm package. There is no RBH_OPT set inside.

Some information:

$ yum list installed |grep robinhood
robinhood-adm.x86_64    2.5.2-1.noarch  @/robinhood-adm-2.5.2-1.noarch.x86_64
robinhood-tmpfs.x86_64  2.5.2-1.el6     @/robinhood-tmpfs-2.5.2-1.el6.x86_64
robinhood-webgui.x86_64 2.5.0-1.noarch  @/robinhood-webgui-2.5.0-1.noarch.x86_64

$ rbh-report -V

Product:         robinhood reporting tool
Version:         2.5.2-1
Build:           2014-05-21 13:51:54





#!/bin/bash
##
# robinhood.init 1.0 2008/02/07 Ph. Gregoire [email protected]
##
# chkconfig:    - 95 5
# description:  robinhood (filesystem purge and audit) service
# processname:  /usr/sbin/robinhood
# config:       /etc/robinhood.d/tmpfs/<filesystem>.conf
##

# Source function library.
. /etc/rc.d/init.d/functions

# variables - may be overwritten by /etc/sysconfig/robinhood
RH_CONF_DIR=/etc/robinhood.d/tmpfs      # directory containing configuration 
files
RH_RUN_DIR=/                                    # directory where daemon will 
run
DAEMON=/usr/sbin/robinhood

# options for starting the daemon
# eg. --scan --purge (leave empty for default actions).
RBH_OPT=""

# Source robinhood configuration.
[ -f /etc/sysconfig/robinhood ] && . /etc/sysconfig/robinhood

VARRUN=/var/run
RETVAL=0


#
# pidfile_name() build the name of the pid file for a given configuration file
# pidfile is like /var/run/robinhood.<fs> if conf file is 
/etc/robinhood.d/<purpose>/<fs>.conf
#
pidfile_name()
{
        local conf=$1
        local pidfile=$VARRUN/rbh.${conf##*/}
        echo ${pidfile%.conf}
}

#
# build_fslist() build the list of configurations files
# configurations files can be given as
# - a full pathname :
#       the script expects that file exists.
# - a filename : <myconfigfile>
#       the script expects to find file 
/etc/robinhood.d/<purpose>/<myconfigfile>.
# - a filesystem name <fsname> :
#       the scripts expects to find a file 
/etc/robinhood.d/<purpose>/<fsname>.conf
# - an empty list :
#       the script take all files directly under /etc/robinhood.d/<purpose>
#
build_fslist()
{
        local fs
        local fs_list=""

        if [[ $# -eq 0 ]]; then
                # no args, consider all files under the configuration directory
                for fs in $(ls -1 $RH_CONF_DIR/*.conf $RH_CONF_DIR/*.cfg 2>&-)
                do
                        [ -f $fs ] && fs_list="$fs_list $fs"
                done
                if [[ -z $fs_list ]] ; then
                        echo "No configuration files under $RH_CONF_DIR" >&2
                        return 1
                fi
        else
                # several args, each may be a full configuration file pathname
                # or filename of a filesystem name
                for fs in $@
                do
                        if [[ $fs = /* ]] && [[ -f $fs ]] ; then
                                fs_list="$fs_list $fs"
                        elif [ -f $RH_CONF_DIR/$fs ] ; then
                                fs_list="$fs_list $RH_CONF_DIR/$fs"
                        elif [ -f $RH_CONF_DIR/$fs.conf ] ; then
                                fs_list="$fs_list $RH_CONF_DIR/$fs.conf"
                        else
                                echo "Unable to find configuration file for 
$fs" >&2
                        fi
                done
        fi
        echo ${fs_list% } # remove leading space
}

#
# daemon_exist()
# check if process corresponding to pidfile exist.
# it must run with the same args.
#
daemon_exist()
{
        local pidfile=$1
        local cmdline=$2
        local pid

        if [ -f $pidfile ] ; then
                # check if there is still some process
                pid=$(<$pidfile)
                if [ -z "${pid//[0-9]/}" -a -d "/proc/$pid" ] ; then
                        local cmd=$(tr '\0' ' ' </proc/$pid/cmdline)
                        if [[ ${cmd% } = $cmdline ]] ; then
                                return 0
                        fi
                fi
        fi
        return 1
}

#
# check_or_start_fs()
# checks if another daemon is not already running for the same purpose,
# then (optionaly) launchs a new daemon with a specific configuration file and 
a specific pid file.
#
check_or_start_fs()
{
        local action=$1
        local conf=$2
        local pidfile=$(pidfile_name $conf)
        if [ -z "$RBH_OPT" ]; then
                local cmdline="$DAEMON -d -f $conf -p $pidfile"
        else
                local cmdline="$DAEMON $RBH_OPT -d -f $conf -p $pidfile"
        fi
        local label="Starting Robinhood for $conf "

        # check if there is still some process
        if daemon_exist $pidfile "$cmdline" ; then
                if [[ $action = START ]] ; then
                        # According to LSB, running "start" on a service 
already running
                        # should be successful.
                        echo "RobinHood already started for $conf"
                        echo_passed
                        echo
                        return 0
                else
                        echo "Robinhood for $conf is running:"
                        ps -fp $(<$pidfile)
                        return 0
                fi
        else
                if [[ $action = START ]] ; then
            # prevent from excessive memory usage
            stack=$(ulimit  -s)
            mem=$(free -k | grep 'Mem:' | awk '{print $2}')
            if [ -n "$stack" ] && (( 32*$stack > $mem)); then
                echo "WARNING: thread stack size (ulimit -s) is surprisingly 
high and may not be adapted to a multithreaded application!" >&2
            fi
                        rm -f $pidfile
                        cd ${RH_RUN_DIR}
                        action "$label ..." $cmdline
                        echo -n "Checking process status... "
                        sleep 1
                        if [ -d /proc/$(<$pidfile) ]; then
                                success "$label"
                        else
                                failure "$label"
                        fi
                        echo
                        #echo -n "$label ..."
                        #if initlog $INITLOG_ARGS -c "$cmdline" "$label" ; then
                        #       success "$label"
                        #else
                        #       failure "$label"
                        #fi
                        #echo
                else
                        echo "Robinhood for $conf is not running"
                        return 1
                fi
        fi

}

#
# stop_fs() stops one daemon instance
#
stop_fs()
{
        local conf=$1
        local pidfile=$(pidfile_name $conf)
        local label="Stopping Robinhood for $conf"
        local rc=0

        #echo -n "$label ..."
        if [ -f $pidfile ] ; then
                local pid=$(<$pidfile)
                if [ -z "${pid//[0-9]/}" ] ; then
                        # this a pid number
                        #[ -d /proc/$pid ] && initlog $INITLOG_ARGS -c 
"/bin/kill kill -TERM $pid" "$label"
                        [ -d /proc/$pid ] && action "$label ..." /bin/kill 
-TERM $pid

                        # wait 10 seconds max
                        for i in `seq 1 10`; do
                                if [ ! -d /proc/$pid ]; then
                                        break;
                                fi

                                sleep 1
                        done
                        #[ -d /proc/$pid ] && initlog $INITLOG_ARGS -c 
"/bin/kill -9 $pid" "$label"
                        [ -d /proc/$pid ] && action "Force shutdown of 
Robinhood for $conf ..." /bin/kill -9 $pid
                        echo -n "Checking process status ..."
                        if [ -d /proc/$pid ] ; then
                                echo_failure
                                rc=1
                        else
                                echo_success
                                rm $pidfile
                        fi
                else
                        echo "$pidfile: bad pid file"
                        echo_failure
                        rc=1
                fi
        else
                # According to LSB, running "stop" on a service already stopped
                # or not running # should be considered successful.
                echo -n "$label ..."
                echo " already stopped"
                echo_passed
        fi
        echo
        return $rc
}

#
# reload_fs
# reload the configuration for the given filesystem
#
reload_fs()
{
        local conf=$1
        local pidfile=$(pidfile_name $conf)
        if [ -z "$RBH_OPT" ]; then
                local cmdline="$DAEMON -d -f $conf -p $pidfile"
        else
                local cmdline="$DAEMON $RBH_OPT -d -f $conf -p $pidfile"
        fi

        # check if there is still some process
        if daemon_exist $pidfile "$cmdline" ; then
                local pid=$(<$pidfile)

                echo "Robinhood for $conf is running: process pid $pid"
                [ -d /proc/$pid ] && action "Reloading configuration for 
process $pid..." /bin/kill -HUP $pid
                return 0
        else
                echo "Robinhood for $conf is not running"
        fi

}

#
# start action
#
start()
{
        local fs
        for fs in $(build_fslist $@)
        do
                check_or_start_fs START $fs
        done
}

#
# stop action
#
stop()
{
        local fs
        for fs in $(build_fslist $@)
        do
                stop_fs $fs
        done
}

#
# status action
#
status()
{
        local fs
        for fs in $(build_fslist $@)
        do
                check_or_start_fs CHECK $fs
        done
}

#
# reload action
#
reload()
{
        local fs
        for fs in $(build_fslist $@)
        do
                reload_fs $fs
        done
}

# See how we were called.
case "$1" in
  start)
        shift
        start $@
        RETVAL=$?
        ;;
  stop)
        shift
        stop $@
        RETVAL=$?
        ;;
  status)
        shift
        status $@
        RETVAL=$?
        ;;
  reload)
        shift
        reload $@
        RETVAL=$?
        ;;
  restart)
        shift
        stop $@
        start $@
        RETVAL=$?
        ;;
  *)
        echo "Usage: $0 {start|stop|status|reload|restart}"
        exit 1
esac

exit $RETVAL
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
robinhood-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/robinhood-support

Reply via email to