From: Chris Koeritz Date: Wed, 10 Jun 2020 19:33:50 +0000 (-0400) Subject: cleaner implementation of keep_awake X-Git-Tag: 2.140.123^2~6^2~6 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=0861b8eb52f8441822f4fd9e36df13b3e293844b cleaner implementation of keep_awake will still put process in background, but now you can control it from the shell. unfortunately, these will probably still zombie out if the connection gets dropped for some reason (either because we're not printing frequently enough or for causes out of our control). --- diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index ff9fec40..0f356d6e 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -932,7 +932,21 @@ return 0 ############## - # site avenger aliases + # tty relevant functions... + + # keep_awake: sends a message to the screen from the background. + function keep_awake() + { + # just starts the keep_awake process in the background. + bash $FEISTY_MEOW_SCRIPTS/tty/keep_awake_process.sh & + # this should leave the job running as %1 or a higher number if there + # are pre-existing background jobs. + } + + ############## + + # site avenger functions... + function switchto() { THISDIR="$FEISTY_MEOW_SCRIPTS/site_avenger" diff --git a/scripts/tty/keep_awake.sh b/scripts/tty/keep_awake.sh deleted file mode 100644 index 861425f3..00000000 --- a/scripts/tty/keep_awake.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# keep_awake: sends a message to the screen from the background. -# -# This program is really just a way to start the keep_awake process in the -# background instead of needing to start a subshell here. There was some -# kind of snafu with the ksh environment variable $$ where it would always -# record the previous shell's number and not the current one or something.... -# -(bash $FEISTY_MEOW_SCRIPTS/tty/keep_awake_process.sh) & diff --git a/scripts/tty/keep_awake_process.sh b/scripts/tty/keep_awake_process.sh index 7c32cef7..eca4ad6b 100644 --- a/scripts/tty/keep_awake_process.sh +++ b/scripts/tty/keep_awake_process.sh @@ -1,18 +1,18 @@ #!/bin/bash + # This program is meant to be started by the program keep_awake and has -# the basic guts that are meant to execute inside of a semi-perpetual loop. +# the guts that are meant to execute inside of a semi-perpetual loop. source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +#hmmm: is there still a process management thingy, referred to below, active in our scripts??? # save the process id for the goodbye program to deal with. #echo $$ >>$TMP/trash.last_keep_awake_process #don't let the shutdown guy know who we are; we want to keep running now. # loop sort of forever. while true; do -# this version is for keeping a modem awake. -# ping -c 7 www.gruntose.com >/dev/null - echo "trying not to fall asleep at $(date_stringer)" - sleep 120 + # magical number of seconds to sleep... + sleep 64 done