Skip to content

Commit

Permalink
Update setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
rmens committed Mar 19, 2024
1 parent 4305016 commit 342823b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ chown -R micrompx:micrompx "$RAMDISK_PATH"
# Clean logs every 7 days to save space on the RAM disk (MicroMPX does this every 30 days)
LOGS_CRONJOB="0 0 * * * find -L $MICROMPX_LOG_DIR -type f -mtime +7 -exec rm {} \;"
echo -e "${BLUE}►► Setting up log file deletion cronjob...${NC}"
# Check if the crontab exists for the current user, create one if not
if ! crontab -l 2>/dev/null; then
echo "No crontab for $(whoami). Creating one..."
echo "" | crontab -
fi
# Add the new cron job if it does not already exist
if ! crontab -l | grep -F -- "$LOGS_CRONJOB" > /dev/null; then
(crontab -l 2>/dev/null; echo "$LOGS_CRONJOB") | crontab -
else
Expand Down

0 comments on commit 342823b

Please sign in to comment.