astroport/zen/sms_AUTH_command.sh

27 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
# RECEIVE COMMAND FROM ./www/LOVELand/g1billet/zen_sms.php
# READ "Number" "Value" from FIFO /tmp/sms.commands
# CALL g1sms/sms_AUTH.sh $line
#################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
# tail -fn 1 /tmp/sms.commands | while read -r line
for line in $(cat /tmp/sms.commands)
do
if [[ $line != "" ]]; then
mycmd="$MY_PATH/../g1sms/sms_AUTH.sh $line"
# RESULT writes IN /tmp/sms.commmand.result
echo "RUN: $mycmd" > /tmp/sms.commmand.result
eval "$mycmd" >> /tmp/sms.commmand.result
sleep 3
fi
done
# ERASE FIFO
[[ -f /tmp/sms.commands ]] && echo "" > /tmp/sms.commands