Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Nov 2017 09:55:02 -0500
From:      Ernie Luzar <luzar722@gmail.com>
To:        Ian Smith <smithi@nimnet.asn.au>
Cc:        Polytropon <freebsd@edvax.de>, Edgar Pettijohn <edgar@pettijohn-web.com>, freebsd-questions@freebsd.org
Subject:   Re: Need help with rc.d script
Message-ID:  <5A046C46.4020807@gmail.com>
In-Reply-To: <20171109185331.B72828@sola.nimnet.asn.au>
References:  <mailman.444.1510052978.1530.freebsd-questions@freebsd.org> <20171108021900.W9710@sola.nimnet.asn.au> <20171108043726.N72828@sola.nimnet.asn.au> <5A01F758.1050706@gmail.com> <20171109005843.E72828@sola.nimnet.asn.au> <5A0332D1.90509@gmail.com> <20171109013818.GA31584@FreeBSD> <20171109040452.d3c25fe2.freebsd@edvax.de> <20171109185331.B72828@sola.nimnet.asn.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for everyones input. But still the service stop command can not 
find the pid file.

In a effort for everyone to play with this problem on their own 
computers I have simplified things as shown below.


  >cat /usr/local/sbin/testloop

#!/bin/sh

  (
    while true; do
      echo -e "Success:"
      logger -t testloop -p daemon.err "Success: log"
      sleep 10
    done
  ) &
    echo $! > /var/run/dynip.pid
    exit 0

The above is what Iam said to try.

  >cat /usr/local/etc/rc.d/testloop

#!/bin/sh
  #
  #
  # PROVIDE: testloop
  # REQUIRE: LOGIN DAEMON NETWORKING
  # KEYWORD: nojail shutdown
  #
  # Add the following line to /etc/rc.conf to enable testloop:
  #
  # testloop_enable="YES"
  #

  . /etc/rc.subr
  name="testloop"
  rcvar=testloop_enable
  pidfile="/var/run/${name}.pid"
  command="/usr/local/sbin/${name}"
  load_rc_config ${name}
  run_rc_command "$1"

service testloop onestart  does indeed start testloop as a daemon. Can 
verify that by using the ps command. But there is no 
/var/run/testloop.pid created, and the service testloop onestop command 
still complains about it not running no pid file.






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