Bug 75824 - [patch] net/jabberd: rc.d/jabberd.sh
Summary: [patch] net/jabberd: rc.d/jabberd.sh
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-04 22:20 UTC by oss-freebsd-ports
Modified: 2005-02-01 11:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oss-freebsd-ports 2005-01-04 22:20:28 UTC
	After a crash jabberd refuses to run if a pidfile exists.
	The patch below checks if a process with the pid contained
	in jabber.pid is running and removes the file if not.

Fix: 

-- /usr/local/etc/rc.d/jabberd.sh.orig      Thu Oct  7 11:54:28 2004
+++ /usr/local/etc/rc.d/jabberd.sh  Tue Jan  4 16:04:59 2005
@@ -19,8 +19,19 @@

 case ${1:-start} in
 start)
-    su -f -m ${USER} -c "jabberd -B -h ${HOSTNAME} -c ${PREFIX}/etc/jabber.xml" ;;
+    if [ -f jabber.pid ]; then
+        pid=`cat jabber.pid`
+        if [ ! -z "$pid" ] && kill -0 -- "$pid"; then
+            echo "A pidfile already exists at the specified location."
+            echo "Check to ensure another copy of the server is not running, or remove the existing file."
+            exit 1
+        fi

+        rm -f ${RUNDIR}/jabber.pid;
+    fi
+
+    su -f -m ${USER} -c "jabberd -B -h ${HOSTNAME} -c ${PREFIX}/etc/jabber.xml"
+    ;;
 stop)
     killall -SIGKILL -u ${USER} jabberd;
     rm -f ${RUNDIR}/jabber.pid;
How-To-Repeat: 
	# [machine crashes, jabberd dies, `killall jabberd`]
	/usr/local/etc/rc.d/jabberd.sh start
	# jabberd fails to start
Comment 1 Volker Stolz freebsd_committer freebsd_triage 2005-01-07 12:03:44 UTC
State Changed
From-To: open->feedback

Forwarded PR to maintainer; tweaked synopsis
Comment 2 Volker Stolz freebsd_committer freebsd_triage 2005-01-07 12:04:24 UTC
Dear maintainer, please review the proposed patch!

Volker
Comment 3 Kirk Strauser 2005-01-07 16:08:29 UTC
On Friday 07 January 2005 06:04, Volker Stolz wrote:

> Dear maintainer, please review the proposed patch!


There are a couple of problems with the patch (and my interaction with it):

1) The PR was submitted against net/jabberd (of which I am the maintainer), 
the the patch is actually against net/jabber (of which I am not).

2) Would this be an appropriate time to switch that file to use rc.subr, 
rather than continuing to patch the old version?

It otherwise looks as though it would work as expected.
-- 
Kirk Strauser
Comment 4 Volker Stolz freebsd_committer freebsd_triage 2005-02-01 11:11:14 UTC
State Changed
From-To: feedback->closed

Committed, thanks!