Skip to content

Commit fb0469c

Browse files
committed
Fix issues with path for pid file
1 parent c2175ea commit fb0469c

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

LinuxExtras/Debian/ircDDBGateway/etc/init.d/ircddbgateway

+12-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,18 @@ do_start()
5757
# 1 if daemon was already running
5858
# 2 if daemon could not be started
5959

60-
# Check if the PID file exists and the actual status of the process
61-
if [ -e $PIDFILE ]; then
62-
status_of_proc -p $PIDFILE $DAEMON_PATH "$NAME process" && status="0" || status="$?"
63-
# If the status is SUCCESS then don't need to start again.
64-
if [ $status = "0" ]; then
65-
return 1 # Exit
60+
# Check if the PID directory and file exists and the actual status of the process
61+
PIDDIR=$(dirname "$PIDFILE")
62+
if [ ! -d "$PIDDIR" ]; then
63+
mkdir $PIDDIR
64+
chown $DAEMON_USER $PIDDIR
65+
else
66+
if [ -e $PIDFILE ]; then
67+
status_of_proc -p $PIDFILE $DAEMON_PATH "$NAME process" && status="0" || status="$?"
68+
# If the status is SUCCESS then don't need to start again.
69+
if [ $status = "0" ]; then
70+
return 1 # Exit
71+
fi
6672
fi
6773
fi
6874

LinuxExtras/Raspbian/ircDDBGateway/etc/init.d/ircddbgateway

+12-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,18 @@ do_start()
5757
# 1 if daemon was already running
5858
# 2 if daemon could not be started
5959

60-
# Check if the PID file exists and the actual status of the process
61-
if [ -e $PIDFILE ]; then
62-
status_of_proc -p $PIDFILE $DAEMON_PATH "$NAME process" && status="0" || status="$?"
63-
# If the status is SUCCESS then don't need to start again.
64-
if [ $status = "0" ]; then
65-
return 1 # Exit
60+
# Check if the PID directory and file exists and the actual status of the process
61+
PIDDIR=$(dirname "$PIDFILE")
62+
if [ ! -d "$PIDDIR" ]; then
63+
mkdir $PIDDIR
64+
chown $DAEMON_USER $PIDDIR
65+
else
66+
if [ -e $PIDFILE ]; then
67+
status_of_proc -p $PIDFILE $DAEMON_PATH "$NAME process" && status="0" || status="$?"
68+
# If the status is SUCCESS then don't need to start again.
69+
if [ $status = "0" ]; then
70+
return 1 # Exit
71+
fi
6672
fi
6773
fi
6874

ircDDBGateway/ircDDBGateway/IRCDDBGatewayAppD.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ int main(int argc, char** argv)
119119

120120
wxString pidFileName;
121121
if (!name.IsEmpty())
122-
pidFileName.Printf(wxT("/var/run/ircddbgateway_%s.pid"), name.c_str());
122+
pidFileName.Printf(wxT("/var/run/opendv/ircddbgateway_%s.pid"), name.c_str());
123123
else
124-
pidFileName = wxT("/var/run/ircddbgateway.pid");
124+
pidFileName = wxT("/var/run/opendv/ircddbgateway.pid");
125125
pidFileName.Replace(wxT(" "), wxT("_"));
126126

127127
char fileName[128U];

0 commit comments

Comments
 (0)