838
840
print "Successfully wrote www/php/phpBB3/config.php"
842
# Write lib/conf/usrmgt-server.init
845
conf = open(usrmgtserver_initdfile, "w")
847
conf.write( '''#! /bin/sh
849
# Works for Ubuntu. Check before using on other distributions
852
# Provides: usrmgt-server
853
# Required-Start: $syslog $networking $urandom
854
# Required-Stop: $syslog
855
# Default-Start: 2 3 4 5
857
# Short-Description: IVLE user management server
858
# Description: Daemon connecting to the IVLE user management database.
861
PATH=/sbin:/bin:/usr/sbin:/usr/bin
862
DESC="IVLE user management server"
864
DAEMON=/opt/ivle/scripts/$NAME
865
DAEMON_ARGS="''' + str(usrmgt_port) + ''' ''' + usrmgt_magic + '''"
866
PIDFILE=/var/run/$NAME.pid
867
SCRIPTNAME=/etc/init.d/usrmgt-server
869
# Exit if the daemon does not exist
870
test -f $DAEMON || exit 0
872
# Load the VERBOSE setting and other rcS variables
873
[ -f /etc/default/rcS ] && . /etc/default/rcS
875
# Define LSB log_* functions.
876
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
877
. /lib/lsb/init-functions
880
# Function that starts the daemon/service
885
# 0 if daemon has been started
886
# 1 if daemon was already running
887
# 2 if daemon could not be started
888
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
890
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
893
# Add code here, if necessary, that waits for the process to be ready
894
# to handle requests from services started subsequently which depend
895
# on this one. As a last resort, sleep for some time.
899
# Function that stops the daemon/service
904
# 0 if daemon has been stopped
905
# 1 if daemon was already stopped
906
# 2 if daemon could not be stopped
907
# other if a failure occurred
908
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
910
[ "$RETVAL" = 2 ] && return 2
911
# Wait for children to finish too if this is a daemon that forks
912
# and if the daemon is only ever run from this initscript.
913
# If the above conditions are not satisfied then add some other code
914
# that waits for the process to drop all resources that could be
915
# needed by services started subsequently. A last resort is to
916
# sleep for some time.
917
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
918
[ "$?" = 2 ] && return 2
919
# Many daemons don't delete their pidfiles when they exit.
925
# Function that sends a SIGHUP to the daemon/service
929
# If the daemon can reload its configuration without
930
# restarting (for example, when it is sent a SIGHUP),
931
# then implement that here.
933
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
939
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
942
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
943
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
947
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
950
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
951
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
954
#reload|force-reload)
956
# If do_reload() is not implemented then leave this commented out
957
# and leave 'force-reload' as an alias for 'restart'.
959
#log_daemon_msg "Reloading $DESC" "$NAME"
963
restart|force-reload)
965
# If the "reload" option is implemented then remove the
966
# 'force-reload' alias
968
log_daemon_msg "Restarting $DESC" "$NAME"
975
1) log_end_msg 1 ;; # Old process is still running
976
*) log_end_msg 1 ;; # Failed to start
986
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
987
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
996
except IOError, (errno, strerror):
997
print "IO error(%s): %s" % (errno, strerror)
1000
# fix permissions as the file contains the database password
1002
os.chmod('doc/setup/usrmgt-server.init', 0600)
1003
except OSError, (errno, strerror):
1004
print "WARNING: Couldn't chmod doc/setup/usrmgt-server.init:"
1005
print "OS error(%s): %s" % (errno, strerror)
1007
print "Successfully wrote lib/conf/usrmgt-server.init"
841
1010
print "You may modify the configuration at any time by editing"
843
1012
print jailconffile
844
1013
print conf_hfile
845
1014
print phpBBconffile
1015
print usrmgtserver_initdfile