Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- mysql_user="xxx"
- mysql_pass="xxx"
- mysql_db="xxx"
- mysql="mysql --skip-column-names -u $mysql_user -p$mysql_pass -D $mysql_db"
- messages=""
- # Appends an error message to the output
- # Parameter 1: the message to append
- function appendMessage {
- messages="$messages\n- $1"
- }
- # Checks if the task with the given UID is active
- # Parameter 1: the uid of the task to check
- # Parameter 2: the name of the task
- function checkForActiveTask {
- crawlerActive=`echo "SELECT COUNT(*) FROM tx_scheduler_task WHERE uid=$1 AND disable=0" | ${mysql}`
- if [ ! "$crawlerActive" -eq "1" ]; then
- appendMessage "$2 task is not active"
- fi
- }
- # Checks if the trigger with the given name exists in the databsae
- # Parameter 1: the name of the trigger
- # Parameter 2: the name of the task
- function checkForTrigger {
- triggerActive=`echo "SHOW TRIGGERS" | ${mysql} | grep $1`
- if [ -z "$triggerActive" ]; then
- appendMessage "$1 trigger does not exist"
- fi
- }
- checkForActiveTask 5 Crawler
- checkForActiveTask 11 "Solr Indexer"
- checkForActiveTask 8 "Cache Garbage Collection"
- checkForTrigger myRequiredTrigger1
- checkForTrigger myRequiredTrigger2
- if [ ! -z "$messages" ]; then
- echo ""
- echo "Warning! System state of -`hostname -f`- is not optimal."
- echo ""
- echo "Please check the following errors:"
- echo -e ${messages}
- echo ""
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement