D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
check_mk_agent
/
local
/
Filename :
cpanel_hooks
back
Copy
#!/usr/bin/env bash #Define variables checked_hooks_filename="/usr/lib/check_mk_agent/etc/cpanel_hooks_check.list" missed_hooks="" missed_hooks_count=0 installed_hooks=`/usr/local/cpanel/bin/manage_hooks list | grep hook | awk '{print $2}' | sort | uniq` #Read checked hooks to array readarray checked_hooks < $checked_hooks_filename #Check if hooks present for hook in "${checked_hooks[@]}" do hook=`echo $hook | sed ':a;N;$!ba;s/\n//g'` if [[ $installed_hooks != *$hook* ]]; then missed_hooks+=" $hook" missed_hooks_count=$((missed_hooks_count+1)) fi done #Return status if [ -n "$missed_hooks" ]; then echo "2 cpanel_hooks missing=${missed_hooks_count} Missing hooks${missed_hooks}" else echo "0 cpanel_hooks missing=0 All hooks installed" fi