System-Administration

Setting Up Log Rotation

Learn how to set up log rotation on Linux.

  1. Create logrotate config:
sudo nano /etc/logrotate.d/myapp
  1. Sample configuration:
/var/log/myapp/*.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
}
  1. Test configuration:
sudo logrotate -d /etc/logrotate.d/myapp

Read more: Logrotate Documentation

Automating Tasks with Cron Jobs

Learn how to automate tasks using cron jobs on Linux.

  1. Edit crontab:
crontab -e
  1. Add a daily backup job:
0 2 * * * /path/to/backup.sh
  1. List current jobs:
crontab -l
  1. Remove all jobs:
crontab -r

Read more: Cron Documentation