rc.d startup script seems to keep running all the time

  • I am trying to write a startup script that runs at boot time for pfsense. I have been able to create one that works correctly, however, I have noticed that, while it runs at boot time, it also runs when certain services, such as openvpn, are restarted.

    Below is the source for my bootscript in rc.d/

    # . /etc/rc.subr
    # name="tinhat"
    # start_cmd="${name}_start"
    # stop_cmd=":"
    # tinhat_start()
    # {
        # /bin/sh /root/./bootlog2.sh
        # /usr/bin/touch /root/ihavestarted
    # }
    # load_rc_config ${name}
    # run_rc_command "$1"

    I played around with the #PROVIDE and #REQUIRE directives, but those had no effect.

    Is there an additional configuration change I need to make in order for this to run only once?

  • @sparkman123 said in rc.d startup script seems to keep running all the time:

    to run only once?

    Here you go :
    Install the Shellcmd package.
    Goto Services > Shellcmd Settings and add a "shellcmd" or "earlyshellcmd".

  • LAYER 8

    did you try to use Shellcmd instead ?
    it's really neat

    Will run the command specified towards the end of the boot process.
    Will run the command specified at the beginning of the boot process.
    Will run after each filter_configure() call. See /etc/inc/filter.inc source code for "documentation".
    Note: Only one entry of this type can be configured!

  • Netgate Administrator

    Yes, using shellcmd is easiest here and it then stores the command in the config file. However to run at rc.d script use /usr/local/etc/rc.d/.


Log in to reply