Advertisement
NickOver

bash : spr serwera

Nov 26th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. #!/bin/bash
  2. lock_file='itLives.lock'
  3.  
  4. if [ -e $lock_file ]
  5. then
  6.     modtime=`stat -c %Y itLives.lock`
  7.     nowtime=`date +%s`
  8.     modtime=$((modtime+0))
  9.     nowtime=$((nowtime-900))
  10.  
  11.     if [ $nowtime -gt $modtime ]
  12.     then
  13.         rm -f $lock_file
  14.     else
  15. #           echo $lock_file
  16.             exit 1;
  17.     fi
  18. fi
  19.  
  20. touch $lock_file
  21.  
  22.  
  23. all="ALL:ok"
  24. results=""
  25.  
  26. while read -r line; do
  27.     for test in `ls tests`
  28.     do
  29.         result=`tests/$test $pages`
  30.         if [ "$result" != "ok" ]
  31.         then
  32.             all=""
  33.  
  34.             if [ "$results" != "" ]
  35.             then
  36.                 results=$results", "
  37.             fi
  38.  
  39.             results=$results$test":"$result
  40.         fi
  41.     done
  42.  
  43.     result=$all$results
  44.  
  45.     lastResult=`cat lastResult.log 2> /dev/null`
  46.  
  47.  
  48.     #if [ "$lastResult" != "$result" ]
  49.     #then
  50.         #for notifications in `ls notifications`
  51.         #do
  52.         #   notifications/$notifications "`date +%H:%M:%S`@`hostname`: $result"
  53.         #done
  54.  
  55.         echo $result > lastResult.log
  56.         echo "`date` - $result" >> results.log
  57.     #fi
  58. done < "pages.txt"
  59. rm -f $lock_file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement