I wanted to push my markdown files to github automatically and I solved it with a cron job.
first, I commit my markdown directory and pushed it to github manually, next I created a script to push it automatically. script
#!/usr/bin/env sh
pusher-obsidian=/home/spot/spotspace/pusher-obsidian
cd $pusher-obsidian
git pull origin main -q
result=$(git status --porcelain | wc -l)
if [[ $result -eq 0 ]] ; then
exit 0
fi
git add .; git commit -q -m "$(date +"%c")"; git push origin main -q
I use a cron job to run script
crontab -e
and put this
@reboot /bin/sleep 120 ; <script_directory>
Top comments (0)