Added phpInterface and shellScripts
This commit is contained in:
63
shellScripts/ShoppingListAdd.sh
Normal file
63
shellScripts/ShoppingListAdd.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
SHOPPINGITEM=""
|
||||
SITEID=""
|
||||
PARAMS=""
|
||||
SESSIONID=""
|
||||
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
--shoppingProduct)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SHOPPINGITEM=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--siteId)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SITEID=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--sessionId)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SESSIONID=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-*|--*=) # unsupported flags
|
||||
echo "Error: Unsupported flag $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
*) # preserve positional arguments
|
||||
PARAMS="$PARAMS $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# set positional arguments in their proper place
|
||||
eval set -- "$PARAMS"
|
||||
|
||||
if [ "$SHOPPINGITEM" = "" ]
|
||||
then
|
||||
echo "Was soll ich auf die Liste setzen?"
|
||||
exit 1
|
||||
else
|
||||
java -jar /home/pi/hc_scripts/ShoppingList.jar --action addToList --shoppingProduct $SHOPPINGITEM
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
63
shellScripts/ShoppingListRemove.sh
Normal file
63
shellScripts/ShoppingListRemove.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
SHOPPINGITEM=""
|
||||
SITEID=""
|
||||
PARAMS=""
|
||||
SESSIONID=""
|
||||
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
--shoppingProduct)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SHOPPINGITEM=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--siteId)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SITEID=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--sessionId)
|
||||
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
|
||||
SESSIONID=$2
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Argument for $1 is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-*|--*=) # unsupported flags
|
||||
echo "Error: Unsupported flag $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
*) # preserve positional arguments
|
||||
PARAMS="$PARAMS $1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# set positional arguments in their proper place
|
||||
eval set -- "$PARAMS"
|
||||
|
||||
if [ "$SHOPPINGITEM" = "" ]
|
||||
then
|
||||
echo "Was soll ich von der Liste streichen?"
|
||||
exit 1
|
||||
else
|
||||
java -jar /home/pi/hc_scripts/ShoppingList.jar --action removeFromList --shoppingProduct $SHOPPINGITEM
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
9
shellScripts/ShoppingListReset.sh
Normal file
9
shellScripts/ShoppingListReset.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
java -jar /home/pi/hc_scripts/ShoppingList.jar --action resetList
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
9
shellScripts/ShoppingListSend.sh
Normal file
9
shellScripts/ShoppingListSend.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
java -jar /home/pi/hc_scripts/ShoppingList.jar --action sendList
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user