quantum / esos

An open source, high performance, block-level storage platform.
http://www.esos-project.com/
Other
287 stars 58 forks source link

Error in the start script /etc/rc.d/rc.nut #206

Closed 6ax closed 6 years ago

6ax commented 6 years ago

Hi,

When executing /etc/rc.d/rc.nut start

Getting an error:

Starting NUT UPS drivers... /etc/rc.d/rc.nut: line 17: /usr/bin/upsdrvctl: No such file or directory

The right path should be this:

/usr/sbin/upsdrvctl

Tnx.

ESOS 1.3.4

msmith626 commented 6 years ago

Thank you; we'll get this fix pushed in the next couple days: diff --git a/etc/rc.d/rc.nut b/etc/rc.d/rc.nut index cb6fe06..ce60f0e 100755 --- a/etc/rc.d/rc.nut +++ b/etc/rc.d/rc.nut @@ -4,7 +4,7 @@ source /etc/rc.d/common

UPSD="/usr/sbin/upsd" UPSMON="/usr/sbin/upsmon" -UPSDRVCTL="/usr/bin/upsdrvctl" +UPSDRVCTL="/usr/sbin/upsdrvctl" UPSD_LOCK="/var/lock/upsd" UPSMON_LOCK="/var/lock/upsmon" UPSDRVCTL_LOCK="/var/lock/upsdrvctl"

Other than that rc script change, NUT is working as expected? Thanks for reporting this.

--Marc

6ax commented 6 years ago

Hi Marc!

Yes, binaries work as expected, but the initialization script is far from perfect. The script will not let the nut run in client mode, only as server and client together. I think it would be better to have two separate scripts for the server mode and client mode. To work only in client mode, I changed your script:

/etc/rc.d/rc.nut-client

! /bin/sh

source /etc/rc.d/common

UPSMON="/usr/sbin/upsmon" UPSMON_LOCK="/var/lock/upsmon" NUT_USER="nutmon" NUT_GROUP="nut"

check_args ${@}

start() { /bin/echo "Starting NUT UPS monitor..." /bin/mkdir -p /var/state/ups/upssched/ && /bin/chown ${NUT_USER}:${NUT_GROUP} /usr/sbin/upssched /usr/bin/upssched-cmd /var/state/ups/upssched && ${UPSMON} -u ${NUT_USER} || exit 1 /bin/touch ${UPSMON_LOCK} }

stop() { /bin/echo "Stopping NUT UPS monitor..." ${UPSMON} -c stop && /bin/rm -f ${UPSMON_LOCK} }

status() { /bin/pidof ${UPSMON} > /dev/null 2>&1 exit ${?} }

${1}

To work only in server mode, I changed your script:

/etc/rc.d/rc.nut-server

! /bin/sh

source /etc/rc.d/common

UPSD="/usr/sbin/upsd" UPSDRVCTL="/usr/sbin/upsdrvctl" UPSD_LOCK="/var/lock/upsd" UPSDRVCTL_LOCK="/var/lock/upsdrvctl" NUT_USER="nutmon"

check_args ${@}

start() { /bin/echo "Starting NUT UPS drivers..." ${UPSDRVCTL} -u ${NUT_USER} start || exit 1 /bin/touch ${UPSDRVCTL_LOCK} /bin/echo "Starting NUT UPS daemon..." ${UPSD} -u ${NUT_USER} || exit 1 /bin/touch ${UPSD_LOCK} }

stop() { /bin/echo "Stopping NUT UPS daemon..." ${UPSD} -c stop && /bin/rm -f ${UPSD_LOCK} /bin/echo "Stopping NUT UPS drivers..." ${UPSDRVCTL} stop && /bin/rm -f ${UPSDRVCTL_LOCK} }

status() { /bin/pidof ${UPSD} > /dev/null 2>&1 exit ${?} }

${1}

P.S Sorry for my bad english.

msmith626 commented 6 years ago

The original issue has been fixed in ESOS 1.3.5 and the new package should post later today. I created a separate issue (#209) for the recommendation of splitting rc.nut into two separate rc scripts. Thank you.