#!/bin/zsh nowTime="$(date +'%Y-%m-%d %H:%M:%S')" echo "# Using crontab with auto.sh" echo "# File in ~/Desktop/auto.sh" echo "# Log in ~/Desktop/cront.log" echo "#" echo "# Auto backup at ${nowTime}" echo "# --------------------------------------------------\n"
cd /Users/username cd $1 echo "Now at $(pwd)\n"
log="auto backup at "${nowTime} git add . git commit -m "$log" result=$(git push site hexo_source_new 2>&1)
case $result in "Everything up-to-date") osascript -e 'display notification "Everything up-to-date." with title "Automatically backup" sound name "basso"' ;; *) osascript -e 'display notification "Done!" with title "Automatically backup" sound name "hero"' ;; esac echo ${result} echo "Backup complete."