opensips

opensipsctl start gives an error: opensips.pid does not exist


When I run opensipsctl start command for start opensips that time I got one error.

ERROR: PID file /var/run/opensips.pid does not exist -- OpenSIPS start failed

So please help me to solve it.


Solution

  • open up opensipsctl, it includes the file opensipsctlrc, which defined $PID_FILE as /var/run/opensips.pid

    Then in opensipsctl, when you run start one of the checks is..

        if [ ! -s $PID_FILE ] ; then
                echo
                merr "PID file $PID_FILE does not exist -- OpenSIPS start failed"
                exit 1
        fi
    

    Which is saying if then check of whethever '/var/run/opensips.pid exists and is bigger than 0 bytes' fails, then echo out the above error.

    This means the file isn't being created.

    If you look just above that line it does..

        if [ $SYSLOG = 1 ] ; then
                $OSIPSBIN -P $PID_FILE $STARTOPTIONS 1>/dev/null 2>/dev/null
        else
                $OSIPSBIN -P $PID_FILE -E $STARTOPTIONS
        fi
    

    Which is where opensips actually starts. I would suggest adding the following to your opensips.cfg if you havn't already..

    # Logging
    debug=6
    log_stderror=no               
    log_facility=LOG_LOCAL0
    

    ..now everything will be logged to /var/log/syslog on boot.

    Try boot again, then look at that log for info about what's happened.

    Another thing to check, is the user you're running opensips as has permission to access the directory it's trying to create the pid file in.