From 3a7aa522c243c0b206e0f5a75076e0ea5fb0be9e Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Sat, 9 Nov 2024 08:00:22 -0700 Subject: [PATCH] 53-rc3 --- cron-reinstall-esp-idf.sh | 49 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/cron-reinstall-esp-idf.sh b/cron-reinstall-esp-idf.sh index 9483104..b9faff8 100644 --- a/cron-reinstall-esp-idf.sh +++ b/cron-reinstall-esp-idf.sh @@ -1,18 +1,31 @@ #!/bin/bash +startTime=$(date '+%s') + # testing: # bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh test # tail -f -n 50 $HOME/esp/install.log -# ls $HOME/esp -# cat $HOME/esp/install.log -# cat $HOME/esp/version-data.txt +# ls $HOME/esp; echo "install.log"; cat $HOME/esp/install.log; echo "version-data.txt"; cat $HOME/esp/version-data.txt + +# delete logs: +# rm -f $HOME/esp/install.log; rm -f $HOME/esp/version-data.txt # cron: # crontab -e # 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh -startTime=$(date '+%s') -cronVers=53-rc2.2 # version of this script -log=$HOME/esp/install.log +cronVers=53-rc3 # version of this script +myUser=princesspi + +gitJobs=5 +installDir=$HOME/esp +log=$installDir/esp/install.log +versionData=$installDir/version-data.txt +gitBranch=master +runningDir="$( cd "$( dirname "$0" )" && pwd )" +idfDir=$installDir/esp-idf +espressifLocation=$HOME/.espressif +customBinLocation=$installDir/.custom_bin +customBinFrom=$runningDir/custom_bin function return_status() { strii="\treturn status: ${?}" @@ -25,21 +38,13 @@ function write_to_log() { echo -e "$1" >> $log } +# function warn_all_users() { +# who | sudo awk '$1 !~ /root/{ cmd="echo '$1' | /usr/bin/write " $1; system(cmd)}' +# } + write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new reinstall ===" write_to_log "Cron version: ${cronVers}" -myUser=$USER - -gitJobs=5 -installDir=$HOME/esp -gitBranch=master -runningDir="$( cd "$( dirname "$0" )" && pwd )" -idfDir=$installDir/esp-idf -espressifLocation=$HOME/.espressif -customBinLocation=$installDir/.custom_bin -customBinFrom=$runningDir/custom_bin -versionData=$installDir/version-data.txt - if [ "$1" == "test" ]; then write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): test mode" gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir" @@ -47,9 +52,6 @@ if [ "$1" == "test" ]; then toolsInstallCmd="echo python $idfDir/tools/idf_tools.py install all" sleepMins=0 - # ls $HOME/esp; echo "install.log"; cat $HOME/esp/install.log; echo "version-data.txt"; cat $HOME/esp/version-data.txt - # rm -f $HOME/esp/install.log; rm -f $HOME/esp/version-data.txt; ls $HOME/esp; - # bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh ls $HOME/esp rm -f $HOME/esp/install.log rm -f $HOME/esp/version-data.txt @@ -68,7 +70,7 @@ else toolsInstallCmd="python $idfDir/tools/idf_tools.py install all" function logout_all_users() { - who | sudo awk '$1 !~ /root/{ cmd="/usr/bin/loginctl terminate-user " $1; system(cmd)}' + who | sudo awk "\$1 !~ /root/{ cmd'echo ${1} | /usr/bin/write ' \$1; system(cmd)}" return $? } fi @@ -181,5 +183,4 @@ if [ "$1" == "test" ]; then echo sudo reboot else sudo reboot -fi - +fi \ No newline at end of file