Thomas Koch wrote:
I'm working on a hadoop package for Debian, which also includes init
scripts
using the daemon program (Debian package "daemon") from
http://www.libslack.org/daemon
Can these scripts be used on other distributions, like Red Hat? Or it's a
Debian only daemon?
I'm not familiar enough with Red Hat do answer this. The first thing that
comes to my mind is, whether Red Hat has the same lsb_* scripts that I do
source.
RHEL doesn't, the daemon scripts for SmartFrog have to look for both
RHEL and lsb; lsb is what you get on SuSE though.
From:
http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/release/scripts/etc/rc.d/init.d/smartfrogd?revision=8160&view=markup
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
STOP_SUPPORTED=0
alias START_DAEMON=start_daemon
# alias STOP_DAEMON=echo "ignoring stop daemon request"
alias STATUS=MyStatus
alias LOG_SUCCESS=log_success_msg
alias LOG_FAILURE=log_failure_msg
alias LOG_WARNING=log_warning_msg
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
STOP_SUPPORTED=1
alias START_DAEMON=start
alias STOP_DAEMON=stop
alias STATUS=status
alias LOG_SUCCESS=success
alias LOG_FAILURE=failure
alias LOG_WARNING=passed
else
echo "Error: your platform is not supported by $0" > /dev/stderr
exit 1
fi
looks like I actually set a flag saying whether stopping the daemon
works reliably, hmmm.
Another handy bit of code:
java -version >/dev/null
if [ $? -ne 0 ]; then
echo "Error: $0 cannot find java. Either it is not installed or the
PATH is incomplete" > /dev/stderr
exit 6
fi
Testing all of this is fun, I scp my RPMs to virtualized machines then
walk them through the lifecycle.