by xoxox » Fri Sep 02, 2011 3:05 pm
Here is the script, nothing special:
$this->bbcode_second_pass_code('', '#!/bin/bash
daemon_name=shairport.pl
. /etc/rc.conf
. /etc/rc.d/functions
get_pid() {
pidof -o %PPID $daemon_name
}
case "$1" in
start)
stat_busy "Starting $daemon_name daemon"
PID=$(get_pid)
if [[ -z $PID ]]; then
[[ -f /var/run/$daemon_name.pid ]] &&
rm -f /var/run/$daemon_name.pid
# RUN
$daemon_name
#
if [[ $? -gt 0 ]]; then
stat_fail
exit 1
else
echo $(get_pid) > /var/run/$daemon_name.pid
add_daemon $daemon_name
stat_done
fi')
Thanks for your help