Sha256: 446f82426446633df886237abc057ee017962aac001d3befc7f89320ce565bd7

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

#!/bin/bash

# Part of rawbotz, (c) Felix Wolfsteller 2016
# Licensed under the GPLv3

set -e

command -v dialog >/dev/null 2>&1 || { 
  echo >&2 "The program 'dialog' seems not to be installed, exiting."
  exit 1
}

PROGRESS_WIDTH=60
PROGRESS_HEIGHT=30

RAWBOTZ_CONF="rawbotz.conf"

menu_selection=$(mktemp /tmp/rawbotz_maintenance.XXXXXX)

dialog --menu "Rawbotz Menu" 18 30 8 \
  1 "Start rawbotz on port 9711" \
  2 "Update local magento products" \
  3 "Look for new remote products" \
  4 "Save current stock data" \
  5 "Trigger Order queue processing" \
  2> tmp

if [ "$?" = 0 ]
then
  _ret=$(cat tmp)
  rm tmp
  if [ "$_ret" = "1" ]
  then
    echo "starting rawbotz"
    ./start_rb.sh
  elif [ "$_ret" = "2" ]
  then
    bundle exec rawbotz_update_local_products -v -c "$RAWBOTZ_CONF" | sed -e 's/.* -- : //' | dialog --progressbox "Update local magento products" $PROGRESS_HEIGHT $PROGRESS_WIDTH
  elif [ "$_ret" = "3" ]
  then
    # program "unbuffer?"
    bundle exec rawbotz_update_remote_products -c "$RAWBOTZ_CONF" -n -w 0 | stdbuf -oL -eL sed -e 's/.* -- : //' | dialog --progressbox "Updating Remote Products" $PROGRESS_HEIGHT $PROGRESS_WIDTH
  elif [ "$_ret" = "4" ]
  then
    rawbotz_stock_update -v -c "$RAWBOTZ_CONF" | dialog --progressbox "Saving current stock data" $PROGRESS_HEIGHT $PROGRESS_WIDTH
  elif [ "$_ret" = "5" ]
  then
    rawbotz_process_order_queue -v -c "$RAWBOTZ_CONF" | dialog --progressbox "Processing Order Queue" $PROGRESS_HEIGHT $PROGRESS_WIDTH
  else
    echo "Bad choice."
    exit 1
  fi
fi

rm "$menu_selection"

exit 0

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rawbotz-0.2.0 exe/rawbotz_maintenance.sh
rawbotz-0.1.5 exe/rawbotz_maintenance.sh
rawbotz-0.1.4 exe/rawbotz_maintenance.sh
rawbotz-0.1.3 exe/rawbotz_maintenance.sh
rawbotz-0.1.2 exe/rawbotz_maintenance.sh