Skip to content

Instantly share code, notes, and snippets.

@gausoft
Created April 16, 2018 16:28
Show Gist options
  • Save gausoft/960c8e7107f503e7707785c01d85f4f4 to your computer and use it in GitHub Desktop.
Save gausoft/960c8e7107f503e7707785c01d85f4f4 to your computer and use it in GitHub Desktop.
A startup script for ejabberd
#! /bin/sh
#
# ejabberd Startup script for the ejabberd server
#
# chkconfig: 345 15 85
# description: The ejabberd instant messaging server is software to communicate \
# and collaborate in real-time between two or more people based on typed text
# processname: ejabberd
set -o errexit
set -o nounset
DIR=/opt/ejabberd-2.1.5
CTL="$DIR"/bin/ejabberdctl
USER=ejabberd
test -d "$DIR" || exit 0
grep ^"$USER": /etc/passwd >/dev/null || exit 0
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
test -x "$CTL" || exit 0
echo "Starting ejabberd..."
su - $USER -c "$CTL start"
su - $USER -c "$CTL started"
echo "done."
;;
stop)
test -x "$CTL" || exit 0
echo "Stopping ejabberd..."
su - $USER -c "$CTL stop"
su - $USER -c "$CTL stopped"
echo "done."
;;
force-reload|restart)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment