functions (576B)
1 SCRIPT_NAME=`basename $0` 2 3 if hash inotifywait 2>/dev/null; then 4 WAIT_FOR_CHANGE="inotifywait -t 60 -e modify" 5 else 6 sleep 1 7 fi 8 9 function log() { 10 logger -t $SCRIPT_NAME -s "$*" 11 } 12 13 function monitor_pending() { 14 #allowed parameter "call", "file" 15 WHAT=$1 16 while grep -q 0 ${WHAT}_pending; do 17 $WAIT_FOR_CHANGE ${WHAT}_pending > /dev/null 2>&1 18 done 19 } 20 21 function stdin_trasher () { 22 { cat > /dev/null <&3 3<&- & } 3<&0 23 echo $! 24 } 25 26 function check_if_dir() { 27 if ! test -e id; then 28 echo "ERROR: Is this a ratox directory?" >&2 29 exit 1 30 fi 31 }