Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Nov 2017 15:11:05 +0000
From:      krad <kraduk@gmail.com>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Need help with rc.d script
Message-ID:  <CALfReyePSRP8azxc=gmDQg_fyUTHrr6K0ii1_w_LNMzQqjX-kQ@mail.gmail.com>
In-Reply-To: <5A01C731.4080309@gmail.com>
References:  <5A00F101.8040708@gmail.com> <alpine.DEB.2.21.9.1711062326320.31397@trent.utfs.org> <CALfReyeWAFA-mUcjPjmKoDkVkG=p1S1%2Br7aCZmoucwPjoG2E0A@mail.gmail.com> <5A01C731.4080309@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
here is an rc script i wrote that handles something similar

#!/bin/sh
#
# $FreeBSD: head/net/lightsg/files/lightsd.in 367807 2014-09-10 09:36:24Z
ehaupt $
#

# PROVIDE: lightsd
# REQUIRE: LOGIN
# BEFORE:  securelevel
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable `lightsd':
#
# lightsd_enable="YES"
# lightsd_flags="<set as needed>"
#
# See lightsg(1) for lightsd_flags
#

. /etc/rc.subr

name="lightsd"
rcvar=lightsd_enable

command="/usr/sbin/daemon"
start_precmd="lightsd_precmd"
pidfile="/var/run/lightsd/$name.pid"

# read configuration and set defaults
load_rc_config "$name"
: ${lightsd_enable="NO"}
: ${lightsd_user:="lightsd"}
: ${lightsd_group:="lightsd"}
: ${lightsd_listen:="localhost:23456"}
: ${lightsd_log:="info"}
: ${lightsd_flags:=""}


command_args="-P $pidfile -p ${pidfile}_child -r /usr/local/bin/$name -l
${lightsd_listen} -v $lightsd_log -S $lightsd_flags 2>&1  "
#command_args="-l ${lightsd_listen} -v debug "

lightsd_precmd()
{
  if [ ! -d "/var/run/lightsd/" ] ; then
    mkdir -pv /var/run/lightsd/
    chown ${lightsd_user}:${lightsd_group} /var/run/lightsd/
  fi
}

run_rc_command "$1"


On 7 November 2017 at 14:46, Ernie Luzar <luzar722@gmail.com> wrote:

> Tried to use the daemon command in the rc.d script with no joy.
>
> this is in the rc.d script
> . /etc/rc.subr
> name=dynip
> rcvar=dynip_enable
> command="/usr/sbin/daemon /usr/local/bin/${name}"
> run_rc_command "$1"
>
> When I use the service command I get this
> /usr/local/etc/rc.d >service dynip onestart
> /usr/local/etc/rc.d/dynip: WARNING: no shebang line in /usr/sbin/daemon
> /usr/local/etc/rc.d/dynip: WARNING: run_rc_command: cannot run
> /usr/sbin/daemon
> /usr/local/bin/dynip
>
> When I run from the command line using this
>
> daemon /usr/local/bin/dynip
>
> ps ax shows it running and has a child task for sleep and it has
> disconnected itself from the terminal that issued the command. But it seems
> to be hung.
>
> Any other suggestions I can try.
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALfReyePSRP8azxc=gmDQg_fyUTHrr6K0ii1_w_LNMzQqjX-kQ>