1

I'm currently trying to get a script to work, which needs to define some LSB functions. This is happening here:

echo "step 1"

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

echo "step 2"

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

echo "step 3"

But the script aborts execution after step2, I never get the output "step 3". This script is the start script for deluged. It used to work, but I noticed that my deluge didn't work anymore and I traced the problem down to this line of code.

Does anyone know what might cause this? The init-functions file exists in the specified directory.

  • use set -x to debug. – user9517 Feb 12 '17 at 18:41
0

You can see an abort during the sourcing of a shell script if something in that shell script uses an exec or an exit instead of a return or just hitting the end of the file.

From the filesystem layout, I'm guessing you are on a RedHat derivative, and on both CentOS 6 and CentOS 7 the /lib/lsb/init-functions file is very short and contains very little by default, so I would not expect the result you are seeing to be possible unless it was modified. Your next debugging step is probably to examine that file for anything else it might be sourcing, and otherwise to insert more debugging messages to find out exactly which line it is aborting on.

| improve this answer | |
0

I found where the problem was: The file had faulty permissions, not allowing the script to read the file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.