You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

git-backup 482B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/env sh
  2. configFile=/etc/git-backup.conf
  3. initPath()
  4. {
  5. cd "$1" && git init && git remote add origin git:backup/$(hostname)$(pwd | tr '/' '-')
  6. }
  7. if [ $# -eq 1 ] && [ "$1" = "--init" ]
  8. then
  9. while read path
  10. do
  11. initPath "${path}"
  12. done < "${configFile}"
  13. exit
  14. fi
  15. while read path
  16. do
  17. echo "Backing up ${path}..."
  18. cd ${path} &&
  19. (
  20. git add -A
  21. git commit -m "[GIT-BACKUP] $(date)"
  22. git push origin master --quiet
  23. )
  24. done < "${configFile}"