Author Topic: Linux RAID-F start issues  (Read 986 times)

Offline Dulanic

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Linux RAID-F start issues
« on: December 22, 2015, 10:05:18 am »
I have been running into a problem /w the auto start that FlexRaid runs each boot. The problem I have seems to be with the system boot order, which I can't seem to fix.  Oh this used to work before the self install FlexRaid installer, this only started once I swapped over to the automated installed that came out.

Basic problem is that during boot sab boots and creates /media/MediaDrive/Download. After this is done, flexraid attempts to boot and errors because the location is not empty... I think as this is a "guess" maybe sab creates it during shutdown if flexraid shutsdown first? This folder will never start with something until FlexRaid starts the storage pool. Below is the log file showing where it "tried" to start at 18:15 and then I manually ran rm -rf /media/MediaDrive/Download and then started the storage pool at 18:16.

What work around that can be done? I have tried putting sleep in the sabnzb init but that didn't seem to do anything. Is there anything on the flexraid side I can do to have to just delete this folder if it exists when trying to mount? I haven't seen any options within FlexRaid to clear anything in the mount folder if it exists?

If not, does anyone know how to make sab nzb reliant upon FlexRaid? The Sab upstart script is pasted below also.

Code: [Select]
[2015-12-19 18:15:50,326] INFO : Setting Http port to 8080
[2015-12-19 18:15:50,327] INFO : Https port not set. Https requests will
not be serviced...
[2015-12-19 18:15:50,327] INFO : Starting FlexRAID...
[2015-12-19 18:15:50,329] INFO : FlexRAID 2.1 [Snapshot 1.1 / Storage Pool
2.0] [2015.11.01]
[2015-12-19 18:15:50,329] INFO : Started: December 19, 2015 6:15:50 PM CST
[2015-12-19 18:15:50,923] WARN : Partition not found for
6a1f7726-d2e5-4453-af70-ee580c246b32!
java.io.IOException: Partition not found for
6a1f7726-d2e5-4453-af70-ee580c246b32!
      at com.tchegbe.lib.io.view.k.l.(Unknown Source)
      at com.tchegbe.lib.io.view.k.l.a(Unknown Source)
      at com.tchegbe.flexraid.main.b.A.init(Unknown Source)
      at org.eclipse.jetty.servlet.ServletHolder.initServlet(Unknown Source)
      at org.eclipse.jetty.servlet.ServletHolder.doStart(Unknown Source)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.(Unknown Source)
      at org.eclipse.jetty.servlet.ServletHandler.initialize(Unknown Source)
      at org.eclipse.jetty.servlet.ServletContextHandler.startContext(Unknown
Source)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(Unknown
Source)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(Unknown
Source)
      at org.eclipse.jetty.server.handler.HandlerCollection.doStart(Unknown
Source)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(Unknown
Source)
      at org.eclipse.jetty.server.handler.HandlerWrapper.(Unknown Source)
      at org.eclipse.jetty.server.Server.doStart(Unknown Source)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(Unknown
Source)
      at com.tchegbe.flexraid.main.Main.a(Unknown Source)
      at com.tchegbe.flexraid.main.Main.main(Unknown Source)
[2015-12-19 18:16:28,288] INFO : Initiating FlexRAID Storage Pool...
[2015-12-19 18:16:28,288] INFO : Host OS = Linux
[2015-12-19 18:16:28,288] INFO : Building View Registry...
[2015-12-19 18:16:28,288] INFO : Building Auto View Registry...
[2015-12-19 18:16:28,292] INFO : Loading View options...
[2015-12-19 18:16:29,162] INFO : Using Auto-View definition...
[2015-12-19 18:16:29,162] INFO : Building View Handler...
[2015-12-19 18:16:29,163] INFO : Mounting Storage Pool drive...

Sab Init, you can see where I tried adding a sleep command to delay this, but that didn't help.

Code: [Select]
#!/bin/sh
#
# Copyright (C) 2008-2013 by JCF Ploemen <linux@jcf.pm>
# released under GPL, version 2 or later

################################################
#                                              #
#  TO CONFIGURE EDIT /etc/default/sabnzbdplus  #
#                                              #
################################################

### BEGIN INIT INFO
# Provides:          sabnzbdplus
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Should-Start:      $named dbus avahi network-manager wicd
# Should-Stop:       $named dbus avahi network-manager wicd
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: SABnzbd+ binary newsgrabber
# Description:       SABnzbd+ is a web-based binary newsgrabber with nzb
#                    support, designed to download files from Usenet.
#                    This script provides that functionality as a system
#                    service, starting the program on boot.
### END INIT INFO
NAME="sabnzbdplus"
DAEMON="/usr/bin/sabnzbdplus"
SETTINGS="/etc/default/$NAME"

([ -x "$DAEMON" ] && [ -r "$SETTINGS" ]) || exit 0

DESC="SABnzbd+ binary newsgrabber"
DEFOPTS="--daemon"
PYTHONEXEC="^$(sed -n '1s/^#\! \?\([a-z0-9\.\/]\+\)\(.*\)/\1(\2)?/p' "$DAEMON")"
PIDFILE="/var/run/$NAME.pid"

# these are only accepted from the settings file
unset USER CONFIG HOST PORT EXTRAOPTS

. /lib/lsb/init-functions

check_retval() {
if [ $? -eq 0 ]; then
log_end_msg 0
return 0
else
log_end_msg 1
exit 1
fi
}

is_running() {
# returns 0 when running, 1 otherwise
PID="$(pgrep -f -x -u ${USER%:*} "$PYTHONEXEC $DAEMON $DEFOPTS.*")"
RET=$?
[ $RET -gt 1 ] && exit 1 || return $RET
}

load_settings() {
if [ -z "$USER" ]; then
. "$SETTINGS"

[ -z "${USER%:*}" ] && {
log_warning_msg "$DESC: service not enabled; edit $SETTINGS";
return 1;
}

OPTIONS="$DEFOPTS"
[ -n "$CONFIG" ] && OPTIONS="$OPTIONS --config-file $CONFIG"
[ -n "$HOST" ] && SERVER="$HOST" || SERVER=
[ -n "$PORT" ] && SERVER="$SERVER:$PORT"
[ -n "$SERVER" ] && OPTIONS="$OPTIONS --server $SERVER"
[ -n "$EXTRAOPTS" ] && OPTIONS="$OPTIONS $EXTRAOPTS"
fi
return 0
}

start_sab() {
load_settings || exit 0
if ! is_running; then
log_daemon_msg "Starting $DESC"
                sleep 10
start-stop-daemon --quiet --chuid $USER --start --exec $DAEMON -- $OPTIONS
check_retval
# create a pidfile; we don't use it but some monitoring app likes to have one
[ -w "$(dirname "$PIDFILE")" ] && \
pgrep -f -x -n -u ${USER%:*} "$PYTHONEXEC $DAEMON $OPTIONS" > "$PIDFILE"
else
log_success_msg "$DESC: already running (pid $PID)"
fi
}

stop_sab() {
load_settings || exit 0
if is_running; then
TMPFILE="$(mktemp --tmpdir sabnzbdplus.XXXXXXXXXX)"
[ $? -eq 0 ] || exit 1
trap '[ -f "$TMPFILE" ] && rm -f "$TMPFILE"' EXIT
echo "$PID" > "$TMPFILE"
log_daemon_msg "Stopping $DESC"
start-stop-daemon --stop --user ${USER%:*} --pidfile "$TMPFILE" --retry 30
check_retval
else
log_success_msg "$DESC: not running"
fi
[ -f "$PIDFILE" ] && rm -f "$PIDFILE"
}

case "$1" in
start)
start_sab
;;
stop)
stop_sab
;;
force-reload|restart)
stop_sab
start_sab
;;
status)
load_settings || exit 4
if is_running; then
log_success_msg "$DESC: running (pid $PID)"
else
log_success_msg "$DESC: not running"
[ -f "$PIDFILE" ] && exit 1 || exit 3
fi
;;
*)
log_failure_msg "Usage: $0 {start|stop|restart|force-reload|status}"
exit 3
;;
esac

exit 0
« Last Edit: December 22, 2015, 10:28:30 am by Dulanic »

Offline Dulanic

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Linux RAID-F start issues
« Reply #1 on: December 25, 2015, 09:10:32 pm »
Ended up finding a work around, posting for others if same issue. Seems sabnzb was the issue since it started prior to flexraid. Still think flexraid needs to have a option to clear the directory on mounting, but this works for now. Ended up creating the following script and execute it in rc.local at the end of booting. This delays starting sab by 2 minutes at least.

Code: [Select]
#!/bin/sh
#replace username with true username
DIR=/home/username

while [ ! -d "$DIR" ]; do
   sleep 120
done

/etc/init.d/sabnzbdplus start