#!/bin/bash CURDIR=$(dirname "$(readlink -f "$0")") source "$CURDIR"/shared-functions.so OUT= TOOL= # ONLINE STATUS function isonline { if [ "$var_conn" = "off" ]; then return 1 else return 0 fi } # NUMBER OF UNSENT EMAILS function check_mailqueue { QUEUE=$(msmtp-listqueue.sh | grep -o "^From: " | wc -l) OUT="$OUT;mq=$QUEUE" TOOL="$TOOL;conn=$var_conn" # If $QUEUE > 0 and >10 runs, show notification if [ "$QUEUE" -gt 0 ]; then var_mailqueue_runs=$(($var_mailqueue_runs + 1)) fi if [ "$QUEUE" -gt 0 ] && [ "$var_mailqueue_runs" -gt 9 ]; then notify-send "There are mails in the mailqueue. Remember sending them manually or switch online status." var_mailqueue_runs=0 # reset counter fi } # SVN STATUS function check_svn { if isonline; then STATUS=$(wget -T 5 -q -O - $SVNSTATUS) EXIT="$?" if ([ "$EXIT" == 4 ] || [ "$EXIT" == 6 ] || [ "$EXIT" == 28 ]); then SVN="t/o" else SVN=$(echo $STATUS | cut -d";" -f1) SVN_REV=$(echo $STATUS | cut -d";" -f2) fi else SVN="offline" SVN_REV="offline" fi OUT="$OUT;svn=$SVN" TOOL="$TOOL;svn=$SVN_REV" } # OUTPUT INFO ON STATUSBAR check_mailqueue check_svn OUT=$(echo $OUT | sed -r 's/^;//') OUT=$(echo $OUT | sed -r 's/;/ \| /g') TOOL=$(echo $TOOL | sed -r 's/^;//') TOOL=$(echo $TOOL | sed -r 's/;/ \| /g') echo "$OUT" echo "$TOOL" echo "/usr/share/icons/gnome/16x16/actions/format-justify-fill.png" echo "xfce4-terminal -x $CURDIR/status-interaction.sh &" wtmp