Basic init.d script for OpenEMM on a SUSE system

Use this forum for questions regarding installation, upgrading and configuration of OpenEMM

Moderator: moderator

roger
Posts: 8
Joined: Tue Mar 02, 2010 11:34 am

Basic init.d script for OpenEMM on a SUSE system

Post by roger »

Below is a very basic script that works in at least my environment.

a) Place a copy of the script in /etc/init.d giving it the name openemm
b) Startup YaST / System Services (Runlevel)
c) Select Expert Mode
d) Select openemm from the list and set it's run levels to 3 and 5
e) Click OK and save the settings

The above creates the correct entries in the rc directories.

On a reboot openemm should auto start and you should be able to use

service openemm start
service openemm stop

from the command line.

The current design of openemm involves a number of python and java apps being run so I have not tried to work out how to get status information.

-----------------------------------------------------------------------------

#! /bin/sh
# Copyright (c) 2010 Roger Thomas.
# Licence Any.
#
# Author: Roger Thomas
#
### BEGIN INIT INFO
# Provides: OpenEMM
# Required-Start: $mysql $sendmail
# Required-Stop:
# Should-Start: $mysql $sendmail
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Control OpenEMM
# Description: Control OpenEMM
### END INIT INFO

touch /var/lock/blah

case "$1" in
start)
echo -n "Initializing OpenEMM"
cd /home/openemm/bin
su - openemm -c "OpenEMM.sh start"
;;
stop)
echo -n "Shutting down OpenEMM"
cd /home/openemm/bin
su - openemm -c "OpenEMM.sh stop"
;;
try-restart)
$0 stop && $0 start
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart}"
exit 1
esac