DevOps / Scripts bash Beginner

Auto-commit Cron Job

Automatically stage and commit all changes in a folder on a schedule — useful for config backups.

bash
#!/bin/bash
REPO=/opt/config-backup
cd $REPO
git add -A
if ! git diff --cached --quiet; then
  git commit -m "Auto-backup $(date +%Y-%m-%d_%H:%M)"
  git push origin main
fi

Prerequisites

  • git
  • SSH key configured for remote

Pro Tips

  • → Run via cron: 0 * * * * /opt/auto-commit.sh

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Beginner
Read time
2 min
Published
Apr 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.