diff --git a/desinstalar b/desinstalar index f7aa18d..da8cd47 100755 --- a/desinstalar +++ b/desinstalar @@ -1,13 +1,19 @@ #!/bin/bash -sudo rm /etc/nodemecu.conf -sudo rm /usr/bin/nodemecu -sudo crontab -u root -r -sudo rm -rf /opt/nodemecu/ -sed -i '/*sudo nodemecu*/d' $HOME/.bashrc -sudo rm /lib/systemd/system/nodemecu.service -sudo systemctl stop nodemecu.service -sudo systemctl disable nodemecu.service -sudo systemctl daemon-reload +if [ $UID -ne 0 ]; then + echo "Ejecute 'sudo $0'" + exit +fi + +source /etc/nodemecu.conf + +rm /etc/nodemecu.conf +rm /usr/bin/nodemecu +crontab -u root -r +rm -rf $directorio_instalacion +systemctl stop nodemecu.service +systemctl disable nodemecu.service +rm /lib/systemd/system/nodemecu.service +systemctl daemon-reload diff --git a/enviar b/enviar deleted file mode 100755 index 93dcdb6..0000000 --- a/enviar +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -#set -e -source /etc/nodemecu.conf -source /opt/nodemecu/functions - - -# Revisando stack - -for filename in /opt/nodemecu/stack/*;do - test "$filename" = "/opt/nodemecu/stack/\*" || break - jsonlint-php $filename > /dev/null || mv -v $filename $corrupt -done - -while :;do - ping -c 1 fsf.org > /dev/null 2>&1 || continue - test_url="$(curl -s -X POST -o /dev/null -w "%{http_code}" $url)" - if [ $test_url -eq 404 ];then - echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> /opt/nodemecu/errors.log && sleep 300 && continue - fi - [ -f $install_dir/lock ] && continue - file=$(get_stack) - [ -z $file ] && continue - local_transaction_uuid=$(jq -r '."transaction_uuid"' $stack/$file) - remote_transaction=$(curl -s --connect-timeout 0,9 --show-error -w "~%{http_code}" -X POST -H "Content-Type: application/json" -d @$stack/$file $url 2> $curl_err) - remote_response="$(echo $remote_transaction | cut -d '~' -f 1)" - server_error="$(echo $remote_transaction | cut -d '~' -f 2)" - if [ ${#remote_response} -eq 36 ];then - - if [ $local_transaction_uuid == $remote_response ]; then - mv $stack/$file $historical - echo -e "$remote_response: \e[92mOK\e[0m" - fi - else - echo -e "$local_transaction_uuid: \e[91mFAIL\e[0m" - # errores - unset srv_msg - unset curl_msg - err_time=$(date +%Y-%m-%d-%H:%M:%S) - [ ! -z "$remote_response" ] && srv_msg="- $( echo $remote_response | grep -o '