X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=brisk.git;a=blobdiff_plain;f=bin%2Fbrisk_explain_update.sh;h=51faf5b97045c32cbcad4c7534f5bdb7ef7901be;hp=295c3deb672721a34d4b0c5d672a2876e014834a;hb=HEAD;hpb=536e323a34cc3b939e3c6611fe2f6eaac54b51e5 diff --git a/bin/brisk_explain_update.sh b/bin/brisk_explain_update.sh index 295c3de..51faf5b 100755 --- a/bin/brisk_explain_update.sh +++ b/bin/brisk_explain_update.sh @@ -1,13 +1,35 @@ #!/bin/bash -set -x +# set -x export PATH=/home/nastasi/bin:/usr/local/bin:/usr/bin:/bin:/usr/games -B_HOSTNAME="http://localhost/brisk" + +CONFIG_FILE="$HOME/.brisk_install" + +# default values +web_url="http://localhost/brisk" +admin_password="" +if [ -f "$CONFIG_FILE" ]; then + source "$CONFIG_FILE" + conffile_in="$CONFIG_FILE" +fi + +tty -s +is_a_tty=$? +if [ -z "$admin_password" ]; then + if [ "$is_a_tty" -eq 0 ]; then + read -s -p "Please insert admin password (no echo): " admin_password + else + echo "Incomplete configuration" + exit 1 + fi +fi + # now="$(date -d '2014-01-21 23:56:00' +%s)" now="$(date +%s)" +delta="86400" -to="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "($now / 86400) * 86400 + 7200 " | bc))" -from="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "($now / 86400) * 86400 + 7200 - (86400)" | bc))" -# to="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "$now + 7200 " | bc))" -# from="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "$now - 9200 " | bc))" +to="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "($now / 86400) * 86400 + 7200 + $delta" | bc))" +from="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "($now / 86400) * 86400 + 7200 - (86400) + $delta" | bc))" +# to="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "$now + 7200 + $delta" | bc))" +# from="$(date +"%Y-%m-%d+%H:%M:%S" -d @$(echo "$now - 9200 + $delta" | bc))" -curl -d 'pazz=yourpasswd' "$B_HOSTNAME/briskin5/stat-day.php?from=$from&to=$to" +curl -d "pazz=$admin_password" "$web_url/briskin5/stat-day.php?from=$from&to=$to"