Files
newznab-tmux/start.sh
T
Darko a1acbf57f9 Removed the two nntp option, removed optimization as it never worked as intended
Changed tmux windows, removed the 32 pp panes and left only one. If you
want to continue using the two nntp providers stay with previous
version.
2013-11-12 12:19:28 +01:00

149 lines
4.8 KiB
Bash
Executable File

#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ ! -f defaults.sh ]; then
clear
echo "Please copy config.sh to defaults.sh"
exit
fi
source defaults.sh
eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php )
if [[ $AGREED == "no" ]]; then
echo "Please edit the defaults.sh file"
exit
fi
$DIR/bin/scripts/check_vars.sh &
pid=$!
wait $!
script_exit_value=$?
if [ "${script_exit_value}" -ne "0" ] ; then
exit 1
fi
#check if tmux session exists, attach if exists, create new if not exist
if $TMUXCMD has-session -t $TMUX_SESSION; then
$TMUXCMD attach-session -t $TMUX_SESSION
else
$DIR/bin/scripts/preflight.sh &
printf "The above is just a TMUX notice, it is saying TMUX, that you do not have a TMUX session currently running. It is not an error. It is TMUX"
printf "\033]0; $TMUX_SESSION\007\003\n"
$TMUXCMD -f $TMUX_CONF new-session -d -s $TMUX_SESSION -n Monitor 'printf "\033]2;Monitor\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -h -p 67 'printf "\033]2;update_binaries\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 30 'printf "\033]2;nzbcount\033\\"'
$TMUXCMD selectp -t 2
$TMUXCMD splitw -v -p 75 'printf "\033]2;backfill\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;import-nzb\033\\"'
$TMUXCMD splitw -v -p 50 'printf "\033]2;update_releases\033\\"'
$TMUXCMD new-window -n Utils 'printf "\033]2;update_predb\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 75 'printf "\033]2;sphinx\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;update_missing_movie_info\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -h -p 50 'printf "\033]2;update_tv\033\\"'
$TMUXCMD selectp -t 2
$TMUXCMD splitw -h -p 50 'printf "\033]2;delete_parts\033\\"'
$TMUXCMD selectp -t 4
$TMUXCMD splitw -h -p 50 'printf "\033]2;postprocessing\033\\"'
$TMUXCMD new-window -n Postproc1 'printf "\033]2;processNfos1\033\\"'
$TMUXCMD splitw -h -p 50 'printf "\033]2;processNfos2\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 75 'printf "\033]2;processGames1\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;processMovies1\033\\"'
$TMUXCMD splitw -v -p 50 'printf "\033]2;processMusic1\033\\"'
$TMUXCMD selectp -t 4
$TMUXCMD splitw -v -p 75 'printf "\033]2;processGames2\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;processMovies2\033\\"'
$TMUXCMD splitw -v -p 50 'printf "\033]2;processMusic2\033\\"'
$TMUXCMD new-window -n Postproc2 'printf "\033]2;processSpotnab\033\\"'
$TMUXCMD splitw -h -p 50 'printf "\033]2;processAnime\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 75 'printf "\033]2;processTVRage\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;processBooks1\033\\"'
$TMUXCMD splitw -v -p 50 'printf "\033]2;processOther\033\\"'
$TMUXCMD selectp -t 4
$TMUXCMD splitw -v -p 75 'printf "\033]2;processTheTVDB\033\\"'
$TMUXCMD splitw -v -p 67 'printf "\033]2;processBooks2\033\\"'
$TMUXCMD splitw -v -p 50 'printf "\033]2;processUnwanted\033\\"'
$TMUXCMD new-window -n FixNames 'printf "\033]2;Fix_Release_Names\033\\"'
$TMUXCMD selectp -t 0
$TMUXCMD splitw -v -p 50 'printf "\033]2;PreDB_Hash_Decrypt\033\\"'
if [[ $USE_HTOP == "true" ]]; then
$TMUXCMD new-window -n htop '$HTOP'
fi
if [[ $USE_NMON == "true" ]]; then
$TMUXCMD new-window -n nmon '$NMON -t'
fi
if [[ $USE_BWMNG == "true" ]]; then
$TMUXCMD new-window -n bwm-ng '$BWMNG'
fi
if [[ $USE_IOTOP == "true" ]]; then
$TMUXCMD new-window -n iotop '$IOTOP -o'
fi
if [[ $USE_TOP == "true" ]]; then
$TMUXCMD new-window -n top '$TOP -m io -zto total'
fi
if [[ $USE_MYTOP == "true" ]]; then
$TMUXCMD new-window -n mytop '$MYTOP -u $DB_USER -p $DB_PASSWORD -d $DB_NAME -h $DB_HOST -s1'
fi
if [[ $USE_VNSTAT == "true" ]]; then
$TMUXCMD new-window -n vnstat 'watch $VNSTAT $VNSTAT_ARGS'
fi
if [[ $USE_IFTOP == "true" ]]; then
$TMUXCMD new-window -n iftop '$IFTOP -i $INTERFACE'
fi
if [[ $USE_ATOP == "true" ]]; then
$TMUXCMD new-window -n atop '$ATOP'
fi
if [[ $USE_TCPTRACK == "true" ]]; then
$TMUXCMD new-window -n tcptrack '$TCPTRACK $TRCPTRACK_ARGS'
fi
if [[ $USE_CONSOLE == "true" ]]; then
$TMUXCMD new-window -n Console 'bash -i'
fi
$TMUXCMD select-window -t$TMUX_SESSION:0
$TMUXCMD respawnp -t 0 'cd bin && $NICE -n$NICENESS $PHP monitor.php'
$TMUXCMD attach-session -d -t$TMUX_SESSION
fi
exit