LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Loadproc and vsftpd (https://www.linuxquestions.org/questions/linux-from-scratch-13/loadproc-and-vsftpd-623169/)

testnbbuser 02-22-2008 06:55 PM

Loadproc and vsftpd
 
Hi all,

I am trying to use the blfs-bootscripts to boot a VSFTPD server that I compiled from source.

All goes well, but when I try to do a /etc/rc.d/init.d/vsftpd start
I got an error in the /etc/rc.d/init.d/functions saying:
line 508: 1557 Terminated nice -n "${nicelevel}" "${@}" [FAIL]

It seems that there is a problem with the nice command.

If I do /etc/rc.d/init.d/vsftpd stop it works properly and the service is stopped. The problem comes when I do the start.

The vsftpd binary is located in /usr/sbin/vsftpd and the my path environment variable is PATH=/bin:/sbin:/usr/bin:/usr/sbin:/tools/bin

Here is a copy of my /etc/rc.d/init.d/vsftpd script:

#!/bin/sh
# Begin $rc_base/init.d/vsftpd

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
start)
boot_mesg "Starting vsFTPD Server..."
loadproc vsftpd
;;

stop)
boot_mesg "Stopping vsFTPD Server..."
killproc vsftpd
;;

reload)
boot_mesg "Reloading vsFTPD Server..."
reloadproc vsftpd
;;

restart)
$0 stop
sleep 1
$0 start
;;

status)
statusproc vsftpd
;;

*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac

# End $rc_base/init.d/vsftpd

and this is the whole function that drops the error in the file /etc/rc.d/init.d/functions :

#*******************************************************************************
# Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]
#
# Purpose: This runs the specified program as a daemon
#
# Inputs: -f, run the program even if it is already running
# -n nicelevel, specifies a nice level. See nice(1).
# -p pidfile, uses the specified pidfile
# pathname, pathname to the specified program
# args, arguments to pass to specified program
#
# Outputs: return 0 - Success
# return 2 - Invalid of excessive arguments, warning in stdout
# return 4 - Program or service status is unknown
#
# Dependencies: nice
#
# Todo: LSB says this should be called start_daemon
# LSB does not say that it should call evaluate_retval
# It checks for PIDFILE, which is depreciated.
# Will be removed after BLFS 6.0
# loadproc returns 0 if program is already running, not LSB compliant
#
#*******************************************************************************
loadproc()
{
local pidfile=""
local forcestart=""
local nicelevel="10"

# This will ensure compatibility with previous LFS Bootscripts
if [ -n "${PIDFILE}" ]; then
pidfile="${PIDFILE}"
fi

while true
do
case "${1}" in
-f)
forcestart="1"
shift 1
;;
-n)
nicelevel="${2}"
shift 2
;;
-p)
pidfile="${2}"
shift 2
;;
-*)
log_failure_msg "Unknown Option: ${1}"
return 2 #invalid or excess argument(s)
;;
*)
break
;;
esac
done

if [ "${#}" = "0" ]; then
log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
return 2 #invalid or excess argument(s)
fi

if [ -z "${forcestart}" ]; then
if [ -z "${pidfile}" ]; then
pidofproc "${1}" > /dev/null
else
pidofproc -p "${pidfile}" "${1}" > /dev/null
fi

case "${?}" in
0)
log_warning_msg "Unable to continue: ${1} is running"
return 0 # 4
;;
1)
log_warning_msg "Unable to continue: ${pidfile} exists"
return 0 # 4
;;
3)
;;
*)
log_failure_msg "Unknown error code from pidofproc: ${?}"
return 4
;;
esac
fi

nice -n "${nicelevel}" "${@}"
evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
return 0
}


Thanks in advance.


All times are GMT -5. The time now is 03:27 PM.