Skip to main content
added 539 characters in body
Source Link
Kahn
  • 1.8k
  • 2
  • 23
  • 41

This is interesting, there is also an entry in /etc/crontab for this job that runs every minute:

    /sbin/service redacted status > /dev/null
    if [ "$?" -gt "0" ]; then
        /bin/rm /var/run/redacted_proc/*
        /sbin/service redacted restart && tail -n 200 /var/log/redacted_proc/redacted_prod.log | mail -s "redacted pid restarted on ${HOSTNAME}" [email protected]
    fi

And ps for that cron job shows as <defunct>.

I am wondering if this somehow caused this program to get run twice.

This is interesting, there is also an entry in /etc/crontab for this job that runs every minute:

    /sbin/service redacted status > /dev/null
    if [ "$?" -gt "0" ]; then
        /bin/rm /var/run/redacted_proc/*
        /sbin/service redacted restart && tail -n 200 /var/log/redacted_proc/redacted_prod.log | mail -s "redacted pid restarted on ${HOSTNAME}" [email protected]
    fi

And ps for that cron job shows as <defunct>.

I am wondering if this somehow caused this program to get run twice.

added 1410 characters in body
Source Link
Kahn
  • 1.8k
  • 2
  • 23
  • 41

I could putam including the contents of the init script here which may make some things more clear.:

#!/bin/bash
# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0
DAEMON=redacted_process
BIN="/usr/bin/redacted_process"
OPTS=""
RUNAS=redacted
PIDDIR=/var/run/${DAEMON}
PIDFILE=${PIDDIR}/${DAEMON}.pid

start () {
    echo -n "Starting ${DAEMON}: "
    [ -f ${PIDFILE} ] && success && echo && return 0
    su -s /bin/bash ${RUNAS} -c "
        cd /
        ${BIN} ${OPTS} &> /dev/null &
        echo \$! > ${PIDFILE}
        disown \$!
    "
    RETVAL=$?
    [ $RETVAL -eq 0 ] && success || failure
    echo
    return $RETVAL
}

stop () {
    echo -n "Shutting down ${DAEMON}: "
    killproc ${DAEMON}
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${DAEMON}
    [ $RETVAL -eq 0 ] && rm -f ${PIDFILE}
    return $RETVAL
}

restart () {
    stop
    start
    RETVAL=$?
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart|reload)
        restart
        ;;
    status)
        status ${DAEMON}
        RETVAL=$?
        ;;
    *)
        echo "Usage: ${0} {start|stop|restart|status}"
        RETVAL=1
esac

exit $RETVAL

I could put the contents of the init script here which may make some things more clear.

I am including the contents of the init script:

#!/bin/bash
# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0
DAEMON=redacted_process
BIN="/usr/bin/redacted_process"
OPTS=""
RUNAS=redacted
PIDDIR=/var/run/${DAEMON}
PIDFILE=${PIDDIR}/${DAEMON}.pid

start () {
    echo -n "Starting ${DAEMON}: "
    [ -f ${PIDFILE} ] && success && echo && return 0
    su -s /bin/bash ${RUNAS} -c "
        cd /
        ${BIN} ${OPTS} &> /dev/null &
        echo \$! > ${PIDFILE}
        disown \$!
    "
    RETVAL=$?
    [ $RETVAL -eq 0 ] && success || failure
    echo
    return $RETVAL
}

stop () {
    echo -n "Shutting down ${DAEMON}: "
    killproc ${DAEMON}
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${DAEMON}
    [ $RETVAL -eq 0 ] && rm -f ${PIDFILE}
    return $RETVAL
}

restart () {
    stop
    start
    RETVAL=$?
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart|reload)
        restart
        ;;
    status)
        status ${DAEMON}
        RETVAL=$?
        ;;
    *)
        echo "Usage: ${0} {start|stop|restart|status}"
        RETVAL=1
esac

exit $RETVAL
added 2 characters in body
Source Link
Kahn
  • 1.8k
  • 2
  • 23
  • 41

This is not a multi-threaded process. With ps and toptop I observed:

This is not a multi-threaded process. With ps and top I observed:

This is not a multi-threaded process. With ps and top I observed:

Source Link
Kahn
  • 1.8k
  • 2
  • 23
  • 41
Loading