Files
mev-beta/scripts/deprecated/setup-log-rotation.sh

24 lines
842 B
Bash
Executable File

#!/bin/bash
# Add this line to your crontab to run log rotation daily at 2 AM:
# 0 2 * * * /home/administrator/projects/mev-beta/scripts/rotate-logs.sh
# This script is meant to be run as a cron job for automatic log rotation
echo "Setting up daily log rotation for MEV Bot..."
# Get the current crontab
crontab -l > /tmp/mev_cron
# Check if our job is already in the crontab
if ! grep -q "rotate-logs.sh" /tmp/mev_cron; then
# Add the log rotation job to run daily at 2 AM
echo "0 2 * * * cd /home/administrator/projects/mev-beta && /home/administrator/projects/mev-beta/scripts/rotate-logs.sh" >> /tmp/mev_cron
# Install the new crontab
crontab /tmp/mev_cron
echo "Log rotation job added to crontab. Will run daily at 2 AM."
else
echo "Log rotation job already exists in crontab."
fi
# Clean up
rm /tmp/mev_cron