freebsd-ports/net-im/openfire/files/wildfire.in
Alexander Botero-Lowry bb7a253a84 Wildfire is an enterprise instant messaging (EIM) server dual-licensed under
the Open Source GPL and commercially. It uses the leading open protocol for
instant messaging, XMPP  (also called Jabber).
Wildfire is incredibly easy to setup and administer, but offers rock-solid
security and performance.

WWW: http://www.jivesoftware.org/wildfire/

PR:		ports/103492
Submitted by:	Nikolay Pavlov <quetzal at zone3000.net>
2006-11-16 08:56:46 +00:00

88 lines
2.1 KiB
Bash

#!/bin/sh
# PROVIDE: wildfire
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# wildfire_enable (bool): Set to NO by default.
# Set it to YES to enable wildfire.
. %%RC_SUBR%%
name="wildfire"
rcvar=${name}_enable
# Set defaults
: ${wildfire_enable:=NO}
: ${wildfire_user:=${name}}
: ${wildfire_group:=${name}}
pidfile=/var/run/${name}.pid
required_files="%%PREFIX%%/etc/wildfire/wildfire.xml"
java_options=" -server -jar \
-Dwildfire.lib.dir=%%JAVAJARDIR%% \
-DwildfireHome=%%DATADIR%%"
java_command=" %%LOCALBASE%%/bin/java ${java_options} \
%%JAVAJARDIR%%/startup.jar"
# Subvert the check_pid_file procname check.
if [ -f $pidfile ]; then
read rc_pid junk < $pidfile
if [ ! -z "$rc_pid" ]; then
procname=`ps -o ucomm= $rc_pid`
fi
fi
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} ${java_command}"
start_precmd="wildfire_precmd"
status_cmd="wildfire_status"
stop_cmd="wildfire_stop"
load_rc_config $name
wildfire_precmd() {
touch ${pidfile}
chown ${wildfire_user}:${wildfire_group} ${pidfile}
}
wildfire_status() {
rc_pid=$(check_pidfile $pidfile *$procname*)
if [ -z "$rc_pid" ]; then
[ -n "$rc_fast" ] && return 0
if [ -n "$pidfile" ]; then
echo "${name} not running? (check $pidfile)."
else
echo "${name} not running?"
fi
return 1
fi
echo "$name is running as pid ${rc_pid}"
}
wildfire_stop() {
rc_pid=$(check_pidfile $pidfile *$procname*)
if [ -z "$rc_pid" ]; then
[ -n "$rc_fast" ] && return 0
if [ -n "$pidfile" ]; then
echo "${name} not running? (check $pidfile)."
else
echo "${name} not running?"
fi
return 1
fi
echo "Stopping ${name}."
kill ${rc_pid}
wait_for_pids ${rc_pid}
rm ${pidfile}
}
run_rc_command "$1"