I've hit a wall trying to understand why the
variable is not working for me. Finally, after letting my script run with
, I see that the
At first I was only using
, but then I read in
so I thought maybe things were getting mixed up, so i added the "command=...." bit, and removed the "start_cmd=...." line, and still no success. Here's the relevant "doit" portion of the output which was saved from running the script with -xv:
_chdir is being set properly, but it's never used for anything. Honestly it looks like those variables (_chdir, _chroot, etc) should be awning_chdir, awning_chroot, etc...
What could be going on?
I'm running version 11.0-RELEASE-p2
Code:
${name}_chdir
Code:
-xv
cd
command is not even being run in my case. Here is my script:
Code:
#!/bin/sh
set -xv
exec 1>/tmp/awning.rclog 2>&1
# REQUIRE: NETWORKING LOGIN DAEMON
# KEYWORD: shutdown
. /etc/rc.subr
name="awning"
rcvar="awning_enable"
awning_chdir="/usr/sbin/awning"
pidfile="/var/run/awningd.pid"
procname="daemon"
# -f flag is to redirect stdin/stdout/stderr to /dev/null to prevent node from crashing
# on system-startup
start_cmd="/usr/sbin/daemon -r -P ${pidfile} -f -u pierre /usr/sbin/awning/intro.js"
command="/usr/sbin/daemon -r -P ${pidfile} -f -u pierre /usr/sbin/awning/intro.js"
load_rc_config $name
run_rc_command "$1"
At first I was only using
Code:
start_cmd
man [MAN]rc.subr[/MAN]
the following:
Code:
${name}_chdir
Directory to [CMD]cd[/CMD] to before running [CMD]command[/CMD], if
${name}_chroot is not provided.
so I thought maybe things were getting mixed up, so i added the "command=...." bit, and removed the "start_cmd=...." line, and still no success. Here's the relevant "doit" portion of the output which was saved from running the script with -xv:
Code:
+ _chdir=/usr/sbin/awning _chroot='' _nice='' _user='' _group='' _groups='' _fib='' _env='' _prepend='' _login_class=daemon _oomprotect=''
+ [ -n '' ]
+ [ -z yes ]
+ [ start '!=' start ]
+ [ -n awning_enable -a start '!=' rcvar -a start '!=' stop -a start '!=' describe ]
+ checkyesno awning_enable
+ eval '_value=$awning_enable'
+ _value=YES
+ debug 'checkyesno: awning_enable is set to YES.'
+ return 0
+ [ start '=' start -a -z yes -a -n '' ]
+ eval '_cmd=$start_cmd' '_precmd=$start_precmd' '_postcmd=$start_postcmd'
+ _cmd='/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js' _precmd='' _postcmd=''
+ [ -n '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js' ]
+ _run_rc_precmd
+ check_required_before start
+ local _f
+ return 0
+ [ -n '' ]
+ check_required_after start
+ local _f _args
+ return 0
+ return 0
+ _run_rc_doit '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ debug 'run_rc_command: doit: /usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ eval '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ /usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js
+ _return=0
+ [ 0 -ne 0 ]
+ return 0
+ _run_rc_postcmd
+ [ -n '' ]
+ return 0
+ return 0
_chdir is being set properly, but it's never used for anything. Honestly it looks like those variables (_chdir, _chroot, etc) should be awning_chdir, awning_chroot, etc...
What could be going on?
I'm running version 11.0-RELEASE-p2