the real fix would be to add the correct path for the distributions and in this case debian to the directadmin based init scripts it is there in older versions of directadmin but not this debian.
I created on debian the following file: /lib/lsb/init-functions.d/directadminfix
Code:
cat > /lib/lsb/init-functions.d/directadminfix << EOF1
__pids_var_run() {
local base=${1##*/}
local pid_file=${2:-/var/run/$base.pid}
pid=
if [ -f "$pid_file" ] ; then
local line p
read line < "$pid_file"
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
done
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"
}
# Output PIDs of matching processes, found using pidof
__pids_pidof() {
pidof -c -o $$ -o $PPID -o %PPID -x "$1" || \
pidof -c -o $$ -o $PPID -o %PPID -x "${1##*/}"
}
status() {
local base pid pid_file=
# Test syntax.
if [ "$#" = 0 ] ; then
echo $"Usage: status [-p pidfile] {program}"
return 1
fi
if [ "$1" = "-p" ]; then
pid_file=$2
shift 2
fi
base=${1##*/}
# First try "pidof"
__pids_var_run "$1" "$pid_file"
RC=$?
if [ -z "$pid_file" -a -z "$pid" ]; then
pid="$(__pids_pidof "$1")"
fi
if [ -n "$pid" ]; then
echo $"${base} (pid $pid) is running..."
return 0
fi
case "$RC" in
0)
echo $"${base} (pid $pid) is running..."
return 0
;;
1)
echo $"${base} dead but pid file exists"
return 1
;;
esac
# See if /var/lock/subsys/${base} exists
if [ -f /var/lock/subsys/${base} ]; then
echo $"${base} dead but subsys locked"
return 2
fi
echo $"${base} is stopped"
return 3
}
EOF1
now the function status and sub functions of __pids_var_run & __pids_pidof required by the centos status are added
and we need to include the functions in the wrong install scripts on the top below the #!/bin/..
debian:
# Source function library.
. /lib/lsb/init-functions
the following init scripts seem to be wrong from the install (that uses the status functions)
(I made a list with)
Code:
for i in `grep -lir "status)"`; do sh /etc/init.d/$i status; done | grep -i "status: command not found"
Code:
./mysqld: line 51: status: command not found
./dovecot: line 68: status: command not found
./freshclam: line 44: status: command not found
./da-popb4smtp: line 62: status: command not found
./clamd: line 44: status: command not found
./proftpd: line 57: status: command not found
./pure-ftpd: line 49: status: command not found
./httpd: line 113: status: command not found
./directadmin: line 77: status: command not found
./exim: line 66: status: command not found
I added
Code:
. /lib/lsb/init-functions
to all these files..
Code:
cd /etc/init.d
for i in "mysqld dovecot freshclam da-popb4smtp clamd proftpd pure-ftpd directadmin exim"; do sed -i 's/#!\/bin\/sh/#!\/bin\/sh\n\n# Source function library.\n. \/lib\/lsb\/init-functions\n/' /etc/init.d/$i; done
sed -i 's/#!\/bin\/bash/#!\/bin\/bash\n\n# Source function library.\n. \/lib\/lsb\/init-functions\n/' /etc/init.d/httpd
and check again:
Code:
for i in `grep -lir "status)"`; do ./$i status; done | grep -i "status: command not found"
-su: ./skeleton: Permission denied
you could add it also to the skeleton file to have newly created entries also corrected..