CHips L MINI SHELL

CHips L pro

Current Path : /proc/3/task/3/cwd/proc/2/root/opt/zabbix_scripts/
Upload File :
Current File : //proc/3/task/3/cwd/proc/2/root/opt/zabbix_scripts/check_old_backup_procs

#!/bin/bash
################################################################################################################
#                                                                                                              #
# Author:   William O.                                                                                         #
# Revision: 20210201.1420                                                                                      #
################################################################################################################

disabledBackupCron=`sudo crontab -u root -l | grep '/opt/backupScript/hostingBackup.sh' | grep -E '^#' | wc -l`
rsnapshotServer=`ps auwx | grep '/usr/local/bin/rsnapshot' | grep -oE '\/etc\/rsnapshot_confs\/[a-z0-9|\.]*\.conf' | cut -d\/ -f4 | sed 's/.conf//'`
oldBackupProcCount=`sudo /usr/bin/find /var/run/hostingBackup/ -mmin +1440 -mmin -2880 -type f | wc -l`


if [ ${disabledBackupCron} == 1 ]
then
    echo "99"
else
    if [ ${oldBackupProcCount} == 1 ]
    then
        oldBackupProcCount=`sudo /usr/bin/find /var/run/hostingBackup/ -mmin +2880 -type f | wc -l`
        oldBackupProcLogCount=`sudo /usr/bin/find /var/log/backupLogs/${rsnapshotServer}_rsnapshot.log -mmin +60 | wc -l`

        if [ ${oldBackupProcLogCount} == 1 ]
        then
            echo "2"
        else
            echo "0"
        fi
    elif [ ${oldBackupProcCount} == 0 ]
    then
        echo "0"
    fi
fi

Copyright 2K16 - 2K18 Indonesian Hacker Rulez