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

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

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
/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

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 24, 2015

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: ****
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

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 24, 2015

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: ****
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

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 24, 2015

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: ****
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 join this conversation on GitHub. Already have an account? Sign in to comment