This commit is contained in:
2024-11-09 17:35:42 -07:00
parent f38d86b104
commit fb7e410712
+18 -7
View File
@@ -13,7 +13,7 @@ startTime=$(date '+%s')
# crontab -e # crontab -e
# 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh # 0 8 * * * bash $HOME/esp/esp-install-custom/cron-reinstall-esp-idf.sh
cronVers=54-release.u1.3 # version of this script cronVers=55-dev # version of this script
myUser=princesspi myUser=princesspi
test=$1 test=$1
@@ -46,8 +46,8 @@ function write_to_log() {
write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new reinstall ===" write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): new reinstall ==="
write_to_log "Cron version: ${cronVers}" write_to_log "Cron version: ${cronVers}"
if [ ! -z $test ]; then if [ "$test" == "test" ]; then
write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): test mode" 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" gitCmd="git clone --jobs $gitJobs --branch $gitBranch --single-branch https://github.com/espressif/esp-idf $idfDir"
installCmd="echo $idfDir/install.sh all" installCmd="echo $idfDir/install.sh all"
toolsInstallCmd="echo python $idfDir/tools/idf_tools.py install all" toolsInstallCmd="echo python $idfDir/tools/idf_tools.py install all"
@@ -57,13 +57,24 @@ if [ ! -z $test ]; then
rm -f $versionData rm -f $versionData
function logout_all_users() { function logout_all_users() {
who | awk '{print $1}' return 0;
return $? }
elif [ "$test" == "nologout" ]; then
write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): NOLOGOUT mode"
sleepMins=3 # minutes of warning to wait for user to log out
gitCmd="git clone --recursive --jobs $gitJobs --branch $gitBranch https://github.com/espressif/esp-idf $idfDir"
installCmd="$idfDir/install.sh all"
toolsInstallCmd="python $idfDir/tools/idf_tools.py install all"
function logout_all_users() {
return 0;
} }
else else
write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): LIVE mode" write_to_log "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): LIVE mode"
sleepMins=3 # minutes of warning to wait for user to log out sleepMins=0 # minutes of warning to wait for user to log out
gitCmd="git clone --recursive --jobs $gitJobs --branch $gitBranch https://github.com/espressif/esp-idf $idfDir" gitCmd="git clone --recursive --jobs $gitJobs --branch $gitBranch https://github.com/espressif/esp-idf $idfDir"
installCmd="$idfDir/install.sh all" installCmd="$idfDir/install.sh all"
@@ -180,7 +191,7 @@ timeElapsed=$(($endTime-$startTime))
write_to_log "reinstall completed in $timeElapsed seconds" write_to_log "reinstall completed in $timeElapsed seconds"
write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): finished ===\n\n" write_to_log " === $(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): finished ===\n\n"
if [ ! -z $test ]; then if [ "$test" == "test" ]; then
echo sudo reboot echo sudo reboot
rm -f $log rm -f $log