HEX
Server: nginx/1.29.3
System: Linux 11979.bigscoots-wpo.com 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User: nginx (1068)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_open,proc_close,popen,show_source,cmd# Do not modify this line # 1684243876
Upload Files
File: //bigscoots/cpanel/rsync_check.sh
#!/bin/bash

# Get the process IDs of rsync processes
rsync_pids=$(ps aux | grep rsync | grep -v grep | awk '{print $2}')

# Current timestamp
current_time=$(date +%s)

# Duration threshold in seconds (12 hours = 12 * 60 * 60 seconds)
threshold=$((12 * 60 * 60))

# Iterate over each rsync process ID
for pid in $rsync_pids; do
    # Get the start time of the process in seconds since epoch
    start_time=$(ps -o lstart= -p $pid --no-headers | xargs -I {} date -d '{}' +%s)

    # Calculate the duration in seconds
    duration=$((current_time - start_time))

    # Check if the duration exceeds the threshold
    if ((duration > threshold)); then
        #echo "Rsync process with PID $pid has been running for more than 12 hours."
        # You can perform any additional actions here, such as terminating the process
        kill $pid
    fi
done