[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Handle-info] handle start stop on boot scripts
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Konstantin,
using a command line option for the password would
mean that the password is visible in /proc. So you
should not use a password which is used for other
things as well. I personally simply do not use any
password and protect the handle server only with
help of file permissions. Have a look at my scripts.
Regards, Eric
/srv/handlesystem/bin/startup.sh -->
#!/bin/bash
# /usr/java/jdk1.5.0_05/bin/java
sudo -u handleuser java -cp /srv/handlesystem/bin/handle.jar:\
/srv/handlesystem/bin/postgresql8jdbc3.jar \
net.handle.server.Main /srv/handlesystem/data/ \
> /srv/handlesystem/bin/startup.log &
/etc/init.d/handleserver -->
#! /bin/sh
#
# Script to start and stop the server for The Handle System
# Based on MPI tomcat5 scripts and init scripts by SuSE Linux GmbH/AG
# Author of this script for The Handle System: Eric Auer
serverIsRunning()
{
is_running="false"
# the [] avoids grepping the grep itself
if ps aux --cols 1024 | grep "n[e]t.handle.server.Main" >/dev/null 2>/dev/null ;
then
is_running="true"
fi
test "$is_running" = "true"
}
. /etc/rc.status
rc_reset
# possible return values: 0 okay 1 error 2 wrong arg 3 unimplemented/missing
# 4 insufficient privs 5 not installed 6 not configured 7 not running
case "$1" in
start)
echo -n "Starting The Handle System"
test -x "/srv/handlesystem/bin/startup.sh" || exit 5
if serverIsRunning ; then
rc_failed 0
else
/srv/handlesystem/bin/startup.sh
sleep 1
if serverIsRunning ; then
rc_failed 0
else
rc_failed 7
fi
fi
rc_status -v
;;
stop)
if serverIsRunning ; then
echo -n "Stopping The Handle System"
kill $(ps aux --cols 1024 | grep "n[e]t.handle.server.Main" | tr -s' ' | cut -d' ' -f2) > /dev/null 2> /dev/null
sleep 1
fi
if serverIsRunning ; then
rc_failed 1
else
rc_failed 0
fi
rc_status -v
;;
try-restart)
# restart but only if it was running
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
# force config reload
$0 stop
$0 start
rc_status
;;
reload)
# reload config only if this is possible without restarting
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for The Handle System"
# return 0 running, 1 dead but w/ pid, 2 dead but w/ lock, 3 off/unused
if serverIsRunning ; then
rc_failed 0
else
rc_failed 3
fi
rc_status -v
;;
probe)
# probe for necessity of reload, return reload command
echo restart
rc_failed 0
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
rc_failed 2
;;
esac
rc_exit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFGf45s99dkROyhRRsRAuXSAJ9sCmwK6sm4UTZlKA7pZm5GEHjLJgCdEtd+
c4SzKnGiImMayAmrTBVOiJQ=
=qHH9
-----END PGP SIGNATURE-----
_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info