Here's a simple setup that you can modify that allows you to sync org
files to your Raspberry Pi, based on your bash script (untested, of course, because I have neither a Pi nor your script). Modify the function with your script name. It uses shell-command-to-string
to put the command line output somewhere; you could also just use shell-command
if that's not a concern.
You can then add it to after-save-hook
, as @IqbalAnsari's comment suggested.
(defun sync-to-pi ()
"Sync org file to Raspberry Pi with external script."
(when (eq major-mode 'org-mode)
(shell-command-to-string (format "your-script-name %s" buffer-file-name))))
(add-hook 'after-save-hook #'sync-to-pi)
after-save-hook
to run the script