CHips L MINI SHELL

CHips L pro

Current Path : /opt/zabbix_scripts/
Upload File :
Current File : //opt/zabbix_scripts/check_UserSymlinkCounts.sh

#!/bin/bash
################################################################################################################
#                                                                                                              #
# !!!!!!!!!!! This file is managed by Puppet.  Do not edit directly.  Changes will be overwritten. !!!!!!!!!!! #
#                                                                                                              #
# Author:   William O.                                                                                         #
# Revision: 20191221.2320                                                                                      #
################################################################################################################


case $1 in
    "cron")
        declare -A cpanelUsersList=$(/usr/sbin/whmapi1 list_users | grep -E '\ *\-\ ' | awk '{print $2}' | grep -vE '^root$' | sort)

        for cpanelUser in ${cpanelUsersList[@]}
        do
            echo $cpanelUser `find /home/${cpanelUser}/public_html/ -type l | wc -l` | grep -vE '\ 0$'
        done | sort -g -r -k 2 > /var/lib/zabbix/UserSymlinkCounts.txt
        ;;
    "zabbix")
        awk '{print $2}' /var/lib/zabbix/UserSymlinkCounts.txt | paste -sd+ - | bc
        ;;
    *)
        echo "Missing Argument"
        ;;
esac

Copyright 2K16 - 2K18 Indonesian Hacker Rulez