-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Medium
-
None
-
Affects Version/s: 6.10.1, 7.17.4
-
Component/s: Installation - Linux - Service
-
None
-
Environment:
Bitbucket Server
Red Hat Version 6.10
-
5
-
Severity 3 - Minor
-
0
Issue Summary
The sample of init.d script doest not work with redhat-lsb package. In redhat-lsb package on RHEL, the following functions used in the sample script init.d are not defined. They are:
- status_of_proc ()
- log_end_msg ()
- log_daemon_msg ()
You will receive the "status_of_proc: command not found" message when checking the status with ./bitbucket status.
Steps to Reproduce
- Use Red Hat OS
- Install and configure Bitbucket Server
- Install redhat-lsb package
- Use init.d sample script as in the KB
- Start the Bitbucket Server using the script
- Type status to check the Bitbucket Status
- You will see "status_of_proc: command not found" message on your terminal
Environment
Bitbucket Server - 6.10.1, 7.17.4
Red Hat Version 6.10
CentOS 7
Expected Results
Able to see the status of Bitbucket Server
Actual Results
The below exception is thrown in the terminal:
./bitbucket status status_of_proc: command not found
Workaround
Adding the functions manually to /lib/lsb/init-functions:
#Custom function to log deamon message
log_end_msg () {
# If no arguments were passed, return
if [ -z "${1:-}" ]; then
return 1
fi
local retval
retval=$1
/etc/redhat-lsb/lsb_log_message success "$@"
if [ $1 -eq 0 ]; then
echo "." || true
elif [ $1 -eq 255 ]; then
/etc/redhat-lsb/lsb_log_message warning "$@"
else
/etc/redhat-lsb/lsb_log_message failure "$@"
fi
return $retval
}
log_daemon_msg () {
if [ -z "${1:-}" ]; then
return 1
fi
if [ -z "${2:-}" ]; then
echo -n "$1:" || true
return
fi
echo -n "$1: $2" || true
}
status_of_proc () {
local pidfile daemon name status OPTIND
pidfile=
OPTIND=1
while getopts p: opt ; do
case "$opt" in
p) pidfile="$OPTARG";;
esac
done
shift $(($OPTIND - 1))
if [ -n "$pidfile" ]; then
pidfile="-p $pidfile"
fi
daemon="$1"
name="$2"
status="0"
pidofproc $pidfile $daemon >/dev/null || status="$?"
if [ "$status" = 0 ]; then
log_success_msg "$name is running"
return 0
elif [ "$status" = 4 ]; then
log_failure_msg "could not access PID file for $name"
return $status
else
log_failure_msg "$name is not running"
return $status
fi
}