Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

nsm_sensor_ps-status shouldn't delete stale PID files #178

Closed
GoogleCodeExporter opened this issue Mar 24, 2015 · 3 comments
Closed

nsm_sensor_ps-status shouldn't delete stale PID files #178

GoogleCodeExporter opened this issue Mar 24, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

/usr/local/lib/nsmnow/lib-nsm-common-utils currently has this:

process_status()
{
        # grab input variables with sane defaulting
        APP=${1:-}
        PID_FILE=${2:-}
        APP_DESC=${3:-}

        echo_msg_begin 1 "$APP_DESC"

        # check for PID file
        if [ -f $PID_FILE ]
        then
                PID=$(cat $PID_FILE)

                # check if PID already running
                if [ "$(ps -ef | grep $APP | grep $PID | grep -v grep | wc -l)" -eq 0 ]
                then
                        echo_msg_end 1
                        echo_msg 1 "stale PID file found, deleting!"
                        rm -f $PID_FILE
                        return 1
                else
                        echo_msg_end 0
                        return 0
                fi
        else
                echo_msg_end 1
                return 1    
        fi
}


It should be changed to:

process_status()
{
        # grab input variables with sane defaulting
        APP=${1:-}
        PID_FILE=${2:-}
        APP_DESC=${3:-}

        echo_msg_begin 1 "$APP_DESC"

        # check for PID file
        if [ -f $PID_FILE ]
        then
                PID=$(cat $PID_FILE)

                # check if PID already running
                if [ "$(ps -ef | grep $APP | grep $PID | grep -v grep | wc -l)" -eq 0 ]
                then
                        echo_msg_end 1
                        echo_msg 1 "stale PID file found!"
                        #rm -f $PID_FILE
                        return 1
                else
                        echo_msg_end 0
                        return 0
                fi
        else
                echo_msg_end 1
                return 1    
        fi
}


Original issue reported on code.google.com by doug.bu...@gmail.com on 4 Jan 2012 at 12:51

@GoogleCodeExporter
Copy link
Author

Actually changed it to:


process_status()
{
        # grab input variables with sane defaulting
        APP=${1:-}
        PID_FILE=${2:-}
        APP_DESC=${3:-}

        echo_msg_begin 1 "$APP_DESC"

        # check for PID file
        if [ -f $PID_FILE ]
        then
                PID=$(cat $PID_FILE)

                # check if PID already running
                if [ "$(ps -ef | grep $APP | grep $PID | grep -v grep | wc -l)" -eq 0 ]
                then
                        echo_msg_end 1
                        echo_msg 1 "stale PID file found, process will be restarted at the next 5-minute interval!"
                        return 1
                else
                        echo_msg_end 0
                        return 0
                fi
        else
                echo_msg_end 1
                return 1
        fi
}

Original comment by doug.bu...@gmail.com on 6 Jan 2012 at 12:03

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Packaged:
/usr/local/lib/ruby/gems/1.9.1/gems/fpm-0.3.11/bin/fpm -s dir -t deb -n 
securityonion-nsmnow-admin-scripts -v 20120106 /etc/init.d/nsm* 
/usr/share/nsmnow/ /usr/local/sbin/nsm* /usr/local/lib/nsmnow/ 
/etc/cron.d/sensor-* /etc/cron.d/nsm* /etc/init/securityonion.conf

Original comment by doug.bu...@gmail.com on 6 Jan 2012 at 3:09

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Published:
http://securityonion.blogspot.com/2012/01/security-onion-20120106-now-available.
html

Original comment by doug.bu...@gmail.com on 6 Jan 2012 at 3:10

  • Changed state: Verified
  • Added labels: ****
  • Removed labels: ****

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant