Answer the question
In order to leave comments, you need to log in
Why doesn't env perl work in rc.d scripts?
FreeBSD 8.2. I'm trying to write an rc.d script to run a perl script on system startup.
perl script:
#!/usr/bin/env perl
print "Hello World!\n";
#!/bin/sh
#
# PROVIDE: mytest
# KEYWORD: FreeBSD
. /etc/rc.subr
name="mytest"
rcvar=`set_rcvar`
start_cmd="mytest_start"
mytest_start ()
{
out=`/home/user/mytest 2>&1`
echo $? > /tmp/file
echo $out >> /tmp/file
}
load_rc_config $name
run_rc_command "$1"
cat /tmp/file
127
env: perl: No such file or directory
Answer the question
In order to leave comments, you need to log in
At the time of rc.d script execution:
PATH=/sbin:/bin:/usr/sbin:/usr/bin
perl is installed in /usr/local/bin/
So far I solved the problem like this:
superuser.com/questions/224974/how -do-i-add-a-loca...
Before executing the command in the rc.d script, add the required path to PATH:
PATH=${PATH}:/usr/local/bin
export PATH
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question