I copied /etc/init.d/functions from a Redhat based system onto an embedded project and got
a "syntax error ( Bad Substitution ) on this line:
[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
when I do service crond start.
I found one redhat change which I put in ( commented 4 lines, added to "to here" ) , didn't help.
Whole function below:
__pids_var_run() {
local base=${1##*/}
local pid_file=${2:-/var/run/$base.pid}
pid=
if [ -f "$pid_file" ] ; then
local liine p
#
https://fedorahosted.org/initscripts...b5fbb9a9e0b745
# read line < "$pid_file"
# for p in $line ; do
# [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
# done
while : ; do
read line
[ -z "$line" ] && break
for p in $line ; do
echo $p
[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
done
done < "$pid_file"
# to here
if [ -n "$pid" ]; then
return 0
fi
return 1 # "Program is dead and /var/run pid file exists"
fi
return 3 # "Program is not running"
}
Ideas? Thanks, dB