0
Votre panier

Comment automatiser les sauvegardes du serveur FiveM

Sauvegarde fivem

In this tutorial, you will learn how to set up automated backups for your FiveM server using a PowerShell script and Windows Task Scheduler. Automating your backups ensures your server data is safe and can be restored if needed.

Step 1: Download the Backup Script

  1. Download the backup script from the Dépôt GitHub.
  2. Sauvegarder le ServerBackupScript.ps1 file in a location accessible to your server.

Télécharger le script ici


Step 2: Set Up Backup Folders

  1. Create Backup Directory:
    • Navigate to your server’s root directory (where the FX Server starter is located).
    • Créez un nouveau dossier nommé sauvegarde.
  2. Edit the PowerShell Script:
    • Ouvrir le ServerBackupScript.ps1 in a text editor (e.g., Notepad).
    • Mettre à jour le $sourcePath to the folder you want to back up. For example: $sourcePath = "C:\MyServer\resources"
    • Mettre à jour le $destinationPath to the folder where backups should be stored. For example: $destinationPath = "C:\Backups\ServerBackup_$backupDate"
    • Les $backupDate variable appends the current date and time to the backup folder name for better organization.

Step 3: Set Up a Scheduled Task

  1. Open Task Scheduler:
    • Presse Win + S and search for Task Scheduler, then open it.
  2. Create a New Task:
    • Clic droit Task Scheduler Library et sélectionnez Create Basic Task.
    • Name the task (e.g., “FiveM Server Backup”) and click Suivant.
  3. Set the Trigger:
    • Choose how often you want the backup to run (e.g., Daily, Weekly).
    • Set the start date, time, and frequency as needed, then click Suivant.
  4. Set the Action:
    • Sélectionner Start a Program et cliquez sur Suivant.
    • Dans le cadre de la Program/script field, type: powershell.exe
    • Dans le cadre de la Add arguments (optional) field, type:-File "C:\Backups\ServerBackupScript.ps1" Adjust the file path if the script is stored elsewhere.
    • Dans le cadre de la Start in (optional) field, type the folder path where the script resides, such as: C:\Backups
  5. Finish the Task:
    • Cliquez sur Finish to save the task.

Step 4: Test the Task

  1. Right-click the newly created task in Task Scheduler and select Exécuter.
  2. Check the output folder (e.g., C:\Backups) to confirm the backup was created successfully. The backup file or folder should have the current date appended to its name (e.g., ServerBackup_2024-11-15).

Step 5: Verify Backup Consistency

  • Regularly check your backups to ensure all critical files are included.
  • Test restoring a backup on a development server to confirm functionality.

Conseils:

  • Monitor Backup Size: Keep an eye on disk space in your destination folder.
  • Retention Policy: Consider a script to delete older backups automatically if storage space is a concern.
  • Logs: Add logging to the PowerShell script for easier debugging.

You have now successfully automated backups for your FiveM server!

PARTAGER:

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *


Use Code BLACKFRIDAY24 for -24%
0
jours
0
heures
0
minutes
0
secondes
fr_FRFrench
0
Votre panier

Aucun produit dans le panier.