:78 Function create_function() is deprecated [8192]
Filename | |
---|---|
tools/racs_monitor.sh |
diff --git a/tools/racs_monitor.sh b/tools/racs_monitor.sh index 44a8802..9abb05d 100644 --- a/tools/racs_monitor.sh +++ b/tools/racs_monitor.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # auxiliary script to monitor RAMdisk and memory utilization # @@ -7,6 +7,12 @@ # ########### +# instead of using the system fn, 'watch' (usually included in the OS for Linux) +# we will define our own, so it also works for MacOS +mywatch() { + while clear; date ; eval $@ ; do sleep 2; done +} + # RAMdisk location ramdisk="/dev/shm" @@ -17,21 +23,24 @@ location="${ramdisk}/${USER}/${RACSdir}*" # Commands # check for files generated in the specified location -cmd1="ls -l $location " +cmd1=" ls -l $location " # check for memory utilization cmd2="free -g " # check for cmd3="du -s -h $location " # separator for separating commands -separator="echo -----------" +separator="echo -----------" # message msg="echo Press 'CTRL-C' to exit the monitoring tool..." # combine commmands obs="$cmd1 ; $separator ; $cmd2 ; $separator ; $cmd3 ; $separator ; $msg" -# for testing purposes -obs="echo '*-*'$obs'-*-' ; $obs" +# a first argument equal to 'DBG' can be used for testing purposes +if [ "${1}" == "DBG" ] +then + obs="echo ';;;; running >>> ' ${obs}' <<< ;;;;' ; ${obs}" +fi # observe... -watch $test +mywatch $obs