Skip to content

Instantly share code, notes, and snippets.

@wesort
Last active July 27, 2026 13:49
Show Gist options
  • Select an option

  • Save wesort/dfbf15e892e8df1708cdd0c0ee73c74a to your computer and use it in GitHub Desktop.

Select an option

Save wesort/dfbf15e892e8df1708cdd0c0ee73c74a to your computer and use it in GitHub Desktop.
Automatic daily backup from production site to GitHub
# Shell script to automatically backup current branch to GitHub
# `:!storage` — on zero-downtime sites storage/ is a symlink to shared storage. Git can't
# descend a symlink, so a bare `git add .` stages the tracked storage/**/.gitignore skeleton
# as deleted. Excluding the path keeps "catch everything" for everything that matters.
git add -A -- ':!storage'
git commit -m "[BOT] Automatic backup via cronjob"
git push
# Instructions
# https://gist.github.com/wesort/dfbf15e892e8df1708cdd0c0ee73c74a
@madsem

madsem commented Feb 23, 2019

Copy link
Copy Markdown

Honestly think I will go this route, thanks for the gist :)
tried making Spock work all day today and it just won't work well for some reason. Will try your way

@wesort

wesort commented Aug 16, 2019

Copy link
Copy Markdown
Author

Example implementation using Scheduler in Laravel Forge

cd ~/example.com/ && ./autobackup.sh > /dev/null

cronjob-example-01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment