Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 May 2008 06:56:26 -0500
From:      Brooks Davis <brooks@freebsd.org>
To:        Paul Schmehl <pauls@utdallas.edu>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: rc.d startup script problem
Message-ID:  <20080514115626.GB69533@lor.one-eyed-alien.net>
In-Reply-To: <14848575EFE82AE05B2027F2@utd65257.utdallas.edu>
References:  <14848575EFE82AE05B2027F2@utd65257.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--yEPQxsgoJgBvi8ip
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 13, 2008 at 02:35:54PM -0500, Paul Schmehl wrote:
> This script will not start if you change the name or location of the conf=
=20
> file in /etc/rc.conf.  For some reason it's not parsing /etc/rc.conf. =20
> Anyone know why?
>=20
> #!/bin/sh
>=20
> # PROVIDE: sancp_agent
> # REQUIRE: DAEMON
> # KEYWORD: shutdown
>=20
> # Add the following line to /etc/sguil-sensor/rc.conf to enable sancp_age=
nt:
> # sancp_agent_enable (bool):    Set to YES to enable sancp_agent
> #                               Default: NO
> # sancp_agent_conf (str):       Sensor_agent configuration file
> #                               Default:=20
> /usr/local/etc/sguil-sensor/sancp_agent.conf
> #
>=20
> . /etc/rc.subr
>=20
> name=3D"sancp_agent"
> rcvar=3D`set_rcvar`
> command=3D"/usr/local/bin/sguil-sensor/sancp_agent.tcl"
> procname=3D"/usr/local/bin/tclsh8.4"
> pidfile=3D"/var/run/${name}.pid"
> check_pidfile=3D"${pidfile} ${procname} /bin/sh"
>=20
> [ -z "$sancp_agent_enable" ]    && sancp_agent_enable=3D"NO"
> [ -z "$sancp_agent_conf" ]      &&=20
> sancp_agent_conf=3D"/usr/local/etc/sguil-sensor/sancp_agent.conf"
> [ -z "$sancp_agent_flags" ]     && sancp_agent_flags=3D"-D"
>=20
> [ -n "$sancp_agent_conf" ]      && sancp_agent_flags=3D"$sancp_agent_flag=
s -c=20
> $sancp_agent_conf"

This section needs to go below load_rc_conf so the variables are
reliably defined.  Also, command_args should generally be used instead
of ${name}_flags.

-- Brooks

> load_rc_config $name
> run_rc_command "$1"
>=20
> # grep sancp /etc/rc.conf
> sancp_agent_enable=3D"YES"
> sancp_agent_conf=3D"/usr/local/etc/sguil-sensor/sancp_agent-ANYSERVER.con=
f"
>=20
> What's the problem?
>=20
> --=20
> Paul Schmehl (pauls@utdallas.edu)
> Senior Information Security Analyst
> The University of Texas at Dallas
> http://www.utdallas.edu/ir/security/
>=20
> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"
>=20

--yEPQxsgoJgBvi8ip
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iD8DBQFIKtNpXY6L6fI4GtQRAl8JAJ4ra7ZLQ4EBwaF4caizIGIhkljhRwCgghem
EpYf6dwRtUhfBcMnV+j0SWU=
=UaMU
-----END PGP SIGNATURE-----

--yEPQxsgoJgBvi8ip--



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