This commit is contained in:
2024-11-12 06:51:51 -07:00
parent c5a73f4e37
commit 3e3b823c61
2 changed files with 19 additions and 2 deletions
+18 -1
View File
@@ -49,6 +49,8 @@ function sleepHold() {
} }
function handleCustomBins() { function handleCustomBins() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling custon bins (function ran)"
if [ -d $customBinLocation ]; then if [ -d $customBinLocation ]; then
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): deleting ${customBinLocation}" writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): deleting ${customBinLocation}"
rm -rf $customBinLocation rm -rf $customBinLocation
@@ -65,6 +67,8 @@ function handleCustomBins() {
} }
function handleExport() { function handleExport() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling export.sh (function ran)"
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): backing up ${idfDir}/export.sh to ${idfDir}/export.sh.bak" writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): backing up ${idfDir}/export.sh to ${idfDir}/export.sh.bak"
cp $idfDir/export.sh $idfDir/export.sh.bak cp $idfDir/export.sh $idfDir/export.sh.bak
returnStatus returnStatus
@@ -79,6 +83,8 @@ function handleExport() {
} }
function handleSetupEnvironment() { function handleSetupEnvironment() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling setup environment (function ran)"
if ! [ -d $installDir ]; then if ! [ -d $installDir ]; then
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): creating ${installDir}" writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): creating ${installDir}"
mkdir $installDir mkdir $installDir
@@ -99,6 +105,8 @@ function handleSetupEnvironment() {
} }
function handleDownloadInstall() { function handleDownloadInstall() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling download and install (function ran)"
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): cloning git branch ${gitBranch} with ${gitJobs} jobs to ${idfDir}" writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): cloning git branch ${gitBranch} with ${gitJobs} jobs to ${idfDir}"
eval "$gitCmd" eval "$gitCmd"
returnStatus returnStatus
@@ -123,6 +131,8 @@ function handleDownloadInstall() {
} }
handleReboot() { handleReboot() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)') Handling reboot: (function ran)"
rebootMsg="$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): rebooting in $sleepMins minutes. save and log out" rebootMsg="$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): rebooting in $sleepMins minutes. save and log out"
writeToLog "$rebootMsg" writeToLog "$rebootMsg"
# warn_all_users "$rebootMsg" # warn_all_users "$rebootMsg"
@@ -131,6 +141,8 @@ handleReboot() {
} }
function handleWarn() { function handleWarn() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling warn (function ran)"
warningString="WARNING:\n\tReinstalling esp-idf in ${sleepMins} minutes! You will be force logged out in ${sleepMins} minutes! Save and log out!\n\tmonitor with \`tail -f -n 50 $HOME/esp/install.log\`\n\tterminate with \`sudo killall cron-reinstall-esp-idf.sh\`\n\t$(date '+%d/%m/%Y %H:%M:%S %Z (%s)')" warningString="WARNING:\n\tReinstalling esp-idf in ${sleepMins} minutes! You will be force logged out in ${sleepMins} minutes! Save and log out!\n\tmonitor with \`tail -f -n 50 $HOME/esp/install.log\`\n\tterminate with \`sudo killall cron-reinstall-esp-idf.sh\`\n\t$(date '+%d/%m/%Y %H:%M:%S %Z (%s)')"
writeToLog $warningString writeToLog $warningString
@@ -143,6 +155,8 @@ function handleWarn() {
} }
function handleLogoutAllUsers() { function handleLogoutAllUsers() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Handling user logout (function ran)"
handleWarn handleWarn
# logout all users # logout all users
@@ -160,6 +174,8 @@ function handleStart() {
} }
function handleEmptyLogs() { function handleEmptyLogs() {
writeToLog "$(date '+%d/%m/%Y %H:%M:%S %Z (%s)'): Emptying logs (function ran)"
rm -f $log rm -f $log
touch $log touch $log
@@ -203,10 +219,11 @@ if [ "$arg" == "test" ]; then
sleepMins=0 sleepMins=0
handleStart handleStart
handleLogoutAllUsers # handleLogoutAllUsers
handleCustomBins handleCustomBins
handleDownloadInstall handleDownloadInstall
handleExport handleExport
# handleEmptyLogs
handleEnd handleEnd
exit exit
+1 -1
View File
@@ -1 +1 @@
60-dev 60-dev.1