Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jul 2005 14:56:26 -0500
From:      Paul Schmehl <pauls@utdallas.edu>
To:        freebsd-rc@freebsd.org
Subject:   Re: New port startup script fails
Message-ID:  <147A3D76415AF3A50F6C0055@Paul-Schmehls-Computer.local>
In-Reply-To: <259A02F8B7F426645765EB45@Paul-Schmehls-Computer.local>
References:  <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123.	GA19090@odin.ac.hmc.edu> <B858D08121B1B491F0217584@utd59514.utdallas.edu> <20	050722004448.GB19090@odin.ac.hmc.edu> <20050723123349.GB1024@rogue.smit.lan> <259A02F8B7F426645765EB45@Paul-Schmehls-Computer.local>

next in thread | previous in thread | raw e-mail | index | archive | help
--On July 23, 2005 10:20:24 AM -0500 Paul Schmehl <pauls@utdallas.edu> 
wrote:

> --On July 23, 2005 3:33:49 PM +0300 Mike Makonnen <mtm@identd.net> wrote:
>
> Thanks.  I made the corrections.  The script now works except for one
> problem.  The tk script spawns two child processes, and when you stop the
> parent, the children don't die.  Is there a way to solve that problem?
>
The script now works, including killing the child process.

Here's the working script:

#!/bin/sh

# PROVIDE: sguild
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD shutdown

# Add the following lines to /etc/rc.conf to enable sguild:
# sguild_enable (bool):         Set to YES to enable sguild
#                               Default: NO
# sguild_flags (str):           Extra flags passed to sguild
#                               Default: -D
# sguild_conf (str):            Sguild configuration file
#                               Default: 
/usr/local/etc/sguil-server/sguild.conf
#

. /etc/rc.subr

name="sguild"
rcvar=`set_rcvar`

command="/usr/local/bin/sguil-server/${name}"
procname="tclsh8.4"

sguild_enable=${sguild_enable-NO}
sguild_conf=${sguild_conf-/usr/local/etc/sguil-server/sguild.conf}
sguild_flags=${sguild_flags--D}

# Hack until run_rc_command() get rid of exit()
sguild_stop() {
    pids=$(reverse_list $(check_process ${procname} [ /bin/sh ]))
    if [ -z ${pids} ]; then
      echo "${name} not running?)."
      return 1
    fi
    echo "Stopping ${name}."
    kill -${sig_stop:-TERM} ${pids}
    [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1
    wait_for_pids ${pids}
}

load_rc_config ${name}
run_rc_command "$1"

Paul Schmehl (pauls@utdallas.edu)
Adjunct Information Security Officer
University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?147A3D76415AF3A50F6C0055>