Secure your project data with a 3-2-1 backup strategy script in 10 minutes
Beginner
10 min
English
Generate a reliable, automated backup script for your database and files without spending hours reading documentation.
Steps
- Open ChatGPT or Claude in your browser.
- Copy the prompt template below and paste it into the chat.
- Replace the {database_type}, {file_directory}, and {cloud_provider} variables with your actual project details.
- Press Enter and review the generated backup script and cron job instructions.
- Ask the AI to explain any specific line if you are unsure what it does (e.g., 'Explain line 4').
- Copy the final script into a file named backup.sh on your server.
- Run the script manually once to verify it creates a backup and uploads it successfully.
- Set up the provided cron job to automate the backup daily.
Prompts to Use
Act as a senior DevOps engineer. I need to implement a 3-2-1 backup strategy for a {database_type} database and a local directory at {file_directory}. Write a bash script that: 1. Dumps the database and archives the directory. 2. Compresses them into a single timestamped file. 3. Uploads the compressed file to {cloud_provider} using their CLI. 4. Deletes local backups older than 7 days. Also, provide the exact cron job syntax to run this script daily at 2 AM. Include brief comments in the script explaining each step.
Tools Used
Some tool links may earn AiA a commission — never affecting rankings.