Scheduling Automatic Backups

8 views Backups & Restoration

Setting Up Cron-Based Backup Schedules

Manually creating backups is easily forgotten. DirectAdmin supports scheduled automatic backups using cron jobs, ensuring your data is regularly backed up without manual intervention.

Using DirectAdmin's Built-in Scheduling

  1. Log in to DirectAdmin and navigate to Advanced Features → Create/Restore Backups.
  2. Look for the Schedule or Cron Backup option (availability depends on your DirectAdmin version and hosting provider configuration).
  3. Configure the schedule:
    • Frequency: Choose daily, weekly, or monthly.
    • Time: Select an off-peak hour (e.g., 2:00 AM or 3:00 AM) to minimize server load impact.
    • Items to include: Select the components you want backed up (files, databases, email).
    • Number of backups to keep: Set a retention count (e.g., keep the last 3 backups) to avoid filling your disk space.
  4. Click Save Schedule or Create.

Manual Cron Job Approach

If the built-in scheduler is not available, you can set up a cron job to trigger backups. Navigate to Advanced Features → Cron Jobs and add a new cron entry:

# Weekly backup every Sunday at 2:00 AM
0 2 * * 0 /usr/local/directadmin/scripts/user_backup.sh
Note: The exact backup script path and options may vary depending on your server's DirectAdmin configuration. Check with your hosting provider for the correct command if the default does not work.

Managing Backup Retention

Automatic backups can quickly consume disk space. To manage this:

  • Set a maximum number of backups to retain. Older backups are automatically deleted when new ones are created.
  • Consider sending backups to a remote server (FTP/SFTP) rather than storing them locally. See the Remote Backup Storage article for details.
  • Periodically check the /home/username/backups/ directory and remove outdated backup files manually if needed.

Verifying Scheduled Backups

After setting up automatic backups, verify they are running correctly by checking the backups directory the next day. Confirm that a new backup file has been created with the expected date and size. It is also good practice to periodically test restoring from a backup to ensure the files are not corrupted.

Need More Help?

Can't find what you're looking for? Our support team is ready to help.

Contact Support
Hi there! How can we help?
Chat with us