Scheduling Automatic Backups
53 vues
Backups & Restoration
<h3>Setting Up Cron-Based Backup Schedules</h3>
<p>Manually creating backups is easily forgotten. DirectAdmin supports scheduled automatic backups using cron jobs, ensuring your data is regularly backed up without manual intervention.</p>
<h3>Using DirectAdmin's Built-in Scheduling</h3>
<ol>
<li>Log in to DirectAdmin and navigate to <strong>Advanced Features → Create/Restore Backups</strong>.</li>
<li>Look for the <strong>Schedule</strong> or <strong>Cron Backup</strong> option (availability depends on your DirectAdmin version and hosting provider configuration).</li>
<li>Configure the schedule:
<ul>
<li><strong>Frequency:</strong> Choose daily, weekly, or monthly.</li>
<li><strong>Time:</strong> Select an off-peak hour (e.g., 2:00 AM or 3:00 AM) to minimize server load impact.</li>
<li><strong>Items to include:</strong> Select the components you want backed up (files, databases, email).</li>
<li><strong>Number of backups to keep:</strong> Set a retention count (e.g., keep the last 3 backups) to avoid filling your disk space.</li>
</ul>
</li>
<li>Click <strong>Save Schedule</strong> or <strong>Create</strong>.</li>
</ol>
<h3>Manual Cron Job Approach</h3>
<p>If the built-in scheduler is not available, you can set up a cron job to trigger backups. Navigate to <strong>Advanced Features → Cron Jobs</strong> and add a new cron entry:</p>
<pre><code># Weekly backup every Sunday at 2:00 AM
0 2 * * 0 /usr/local/directadmin/scripts/user_backup.sh</code></pre>
<div class="alert alert-info"><strong>Note:</strong> 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.</div>
<h3>Managing Backup Retention</h3>
<p>Automatic backups can quickly consume disk space. To manage this:</p>
<ul>
<li>Set a maximum number of backups to retain. Older backups are automatically deleted when new ones are created.</li>
<li>Consider sending backups to a remote server (FTP/SFTP) rather than storing them locally. See the Remote Backup Storage article for details.</li>
<li>Periodically check the <code>/home/username/backups/</code> directory and remove outdated backup files manually if needed.</li>
</ul>
<h3>Verifying Scheduled Backups</h3>
<p>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.</p>
Besoin d'aide ?
Vous ne trouvez pas ce que vous cherchez ? Notre équipe de support est prête à vous aider.
Contacter le support