Skip to content

Commit

Permalink
Several fixes and improvements in ejabberd.init.template
Browse files Browse the repository at this point in the history
Changes:
* Set script as executable
* Add LSB tags and overrides, copied from Debian's ejabberd package
* Add chkconfig support (thanks to Ivan Martinez)(EJAB-1450)
* Don't use nounset, as that breaks when no argument is provided
* Add status command
  • Loading branch information
badlop committed May 24, 2011
1 parent 7bc879c commit f850bcb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ install: all
sed -e "s*@ctlscriptpath@*$(SBINDIR)*" \
-e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \
> ejabberd.init
chmod 555 ejabberd.init
#
# Binary Erlang files
install -d $(BEAMDIR)
Expand Down
25 changes: 21 additions & 4 deletions src/ejabberd.init.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#! /bin/sh

### BEGIN INIT INFO
# Provides: ejabberd
# Required-Start: $remote_fs $network $named $time
# Required-Stop: $remote_fs $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts ejabberd jabber server
# Description: Starts ejabberd jabber server, an XMPP
# compliant server written in Erlang.
### END INIT INFO

# chkconfig: 2345 90 10
# description: ejabberd XMPP server

set -o errexit
set -o nounset

DIR=@ctlscriptpath@
CTL="$DIR"/ejabberdctl
Expand Down Expand Up @@ -32,14 +46,17 @@ case "$1" in
su - $USER -c "$CTL stopped"
echo "done."
;;

status)
test -x "$CTL" || exit 0
echo "Getting ejabberd status..."
su - $USER -c "$CTL status"
;;
force-reload|restart)
"$0" stop
"$0" start
;;

*)
echo "Usage: $0 {start|stop|restart|force-reload}"
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
esac

Expand Down

0 comments on commit f850bcb

Please sign in to comment.