diff --git a/debian/cocaine-native-proxy.init b/debian/cocaine-native-proxy.init index eb4af2b..f249cc7 100644 --- a/debian/cocaine-native-proxy.init +++ b/debian/cocaine-native-proxy.init @@ -38,12 +38,19 @@ do_start() ARGS=" -c $conf" ulimit -n 65000; start-stop-daemon -S -p $PIDFILE -b -m -u $USER -d $CONFIG_DIR --exec $DAEMON -- $ARGS - - if [ $? -ne 0 ]; - then + if [ $? -ne 0 ]; then echo "FAIL" + return 1 + fi + + pid=$(cat $PIDFILE 2>/dev/null) + echo -n ' ..... ' + sleep 0.5 + if kill -0 $pid 2>/dev/null + then + echo "OK" else - echo "OK" + echo "FAIL" fi done } diff --git a/proxy.cpp b/proxy.cpp index 7699c45..e513be8 100644 --- a/proxy.cpp +++ b/proxy.cpp @@ -140,8 +140,11 @@ proxy::initialize(const rapidjson::Value &config) { } proxy::~proxy() { - COCAINE_LOG_INFO(m_service_manager->get_system_logger(), - "Proxy will be stopped now."); + // in case of malformed config it could be uninitialized + if (m_service_manager) { + COCAINE_LOG_INFO(m_service_manager->get_system_logger(), + "Proxy will be stopped now."); + } m_service_manager.reset(); }