DEV Community

Indra Wahyu
Indra Wahyu

Posted on


Push Note File like Obsidian to GitHub using Cronie

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


cd $pusher-obsidian

git pull origin main -q

result=$(git status --porcelain | wc -l)

if [[ $result -eq 0 ]] ; then
        exit 0

        git add .; git commit -q -m "$(date +"%c")"; git push origin main -q
Enter fullscreen mode Exit fullscreen mode

I use a cron job to run script

crontab -e
Enter fullscreen mode Exit fullscreen mode

and put this

@reboot /bin/sleep 120 ;  <script_directory>
Enter fullscreen mode Exit fullscreen mode


Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.