Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. mysql_user="xxx"
  4. mysql_pass="xxx"
  5. mysql_db="xxx"
  6. mysql="mysql --skip-column-names -u $mysql_user -p$mysql_pass -D $mysql_db"
  7.  
  8. messages=""
  9.  
  10. # Appends an error message to the output
  11. # Parameter 1: the message to append
  12. function appendMessage {
  13. messages="$messages\n- $1"
  14. }
  15.  
  16. # Checks if the task with the given UID is active
  17. # Parameter 1: the uid of the task to check
  18. # Parameter 2: the name of the task
  19. function checkForActiveTask {
  20. crawlerActive=`echo "SELECT COUNT(*) FROM tx_scheduler_task WHERE uid=$1 AND disable=0" | ${mysql}`
  21. if [ ! "$crawlerActive" -eq "1" ]; then
  22. appendMessage "$2 task is not active"
  23. fi
  24. }
  25.  
  26. # Checks if the trigger with the given name exists in the databsae
  27. # Parameter 1: the name of the trigger
  28. # Parameter 2: the name of the task
  29. function checkForTrigger {
  30. triggerActive=`echo "SHOW TRIGGERS" | ${mysql} | grep $1`
  31. if [ -z "$triggerActive" ]; then
  32. appendMessage "$1 trigger does not exist"
  33. fi
  34. }
  35.  
  36. checkForActiveTask 5 Crawler
  37. checkForActiveTask 11 "Solr Indexer"
  38. checkForActiveTask 8 "Cache Garbage Collection"
  39.  
  40. checkForTrigger myRequiredTrigger1
  41. checkForTrigger myRequiredTrigger2
  42.  
  43. if [ ! -z "$messages" ]; then
  44. echo ""
  45. echo "Warning! System state of -`hostname -f`- is not optimal."
  46. echo ""
  47. echo "Please check the following errors:"
  48. echo -e ${messages}
  49. echo ""
  50. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement