From adc05a37dc30ba4e7c2ea0ae64137805ee392eda Mon Sep 17 00:00:00 2001 From: KemoNine Date: Thu, 1 Sep 2022 15:54:41 -0400 Subject: [PATCH] tweak emacs to use a sync script so the sync can be called via shortcuts manually if desired --- shortcuts/emacs | 31 ++++--------------------------- shortcuts/rclone-local-nc | 29 +++++++++++++++++++++++++++++ shortcuts/rclone-nc-local | 29 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 27 deletions(-) create mode 100755 shortcuts/rclone-local-nc create mode 100755 shortcuts/rclone-nc-local diff --git a/shortcuts/emacs b/shortcuts/emacs index c4fd23f..22e6652 100755 --- a/shortcuts/emacs +++ b/shortcuts/emacs @@ -2,41 +2,18 @@ # debugging #echo $1 -#export RC_DEBUG="-P --dry-run" - -# org storage locations -export LOCAL_ORG="/data/data/com.termux/files/home/storage/shared/org/" -export NC_ORG="nc-personal:/org/" - -# rclone common flags/switches -export RC_COMMON="--delete-after --fast-list --human-readable --interactive" -export RC_EXCLUDE="--exclude=archivebox --exclude=/Attic/** --exclude=/Documents/**" # get a wake lock so we dont get background killed /data/data/com.termux/files/usr/bin/termux-wake-lock -# sync org data to local device (pull down outstanding changes, if any) -echo "starting rclone from nextcloud -> local storage" -/data/data/com.termux/files/usr/bin/rclone sync \ - $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ - $NC_ORG $LOCAL_ORG - -# pause to review rclone output -echo "press enter to continue" -read junkvar +# nextcloud auto-sync +/data/data/com.termux/files/home/.shortcuts/rclone-nc-local # run emacs ; assume this will run awhile -- mind battery drain /data/data/com.termux/files/usr/bin/emacs --with-profile $1 -# sync any local changes up to the main server -echo "starting rclone from local storage -> nextcloud" -/data/data/com.termux/files/usr/bin/rclone sync \ - $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ - $LOCAL_ORG $NC_ORG - -# pause to review rclone output -echo "press enter to continue" -read junkvar +# nextcloud auto-sync +/data/data/com.termux/files/home/.shortcuts/rclone-local-nc # release wake lock /data/data/com.termux/files/usr/bin/termux-wake-unlock diff --git a/shortcuts/rclone-local-nc b/shortcuts/rclone-local-nc new file mode 100755 index 0000000..29095d0 --- /dev/null +++ b/shortcuts/rclone-local-nc @@ -0,0 +1,29 @@ +#!/data/data/com.termux/files/usr/bin/sh + +# debugging +#echo $1 +#export RC_DEBUG="-P --dry-run" + +# org storage locations +export LOCAL_ORG="/data/data/com.termux/files/home/storage/shared/org/" +export NC_ORG="nc-personal:/org/" + +# rclone common flags/switches +export RC_COMMON="--delete-after --fast-list --human-readable --interactive" +export RC_EXCLUDE="--exclude=archivebox --exclude=/Attic/** --exclude=/Documents/**" + +# get a wake lock so we dont get background killed +/data/data/com.termux/files/usr/bin/termux-wake-lock + +# sync any local changes up to the main server +echo "starting rclone from local storage -> nextcloud" +/data/data/com.termux/files/usr/bin/rclone sync \ + $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ + $LOCAL_ORG $NC_ORG + +# pause to review rclone output +echo "press enter to continue" +read junkvar + +# release wake lock +/data/data/com.termux/files/usr/bin/termux-wake-unlock diff --git a/shortcuts/rclone-nc-local b/shortcuts/rclone-nc-local new file mode 100755 index 0000000..af08baf --- /dev/null +++ b/shortcuts/rclone-nc-local @@ -0,0 +1,29 @@ +#!/data/data/com.termux/files/usr/bin/sh + +# debugging +#echo $1 +#export RC_DEBUG="-P --dry-run" + +# org storage locations +export LOCAL_ORG="/data/data/com.termux/files/home/storage/shared/org/" +export NC_ORG="nc-personal:/org/" + +# rclone common flags/switches +export RC_COMMON="--delete-after --fast-list --human-readable --interactive" +export RC_EXCLUDE="--exclude=archivebox --exclude=/Attic/** --exclude=/Documents/**" + +# get a wake lock so we dont get background killed +/data/data/com.termux/files/usr/bin/termux-wake-lock + +# sync org data to local device (pull down outstanding changes, if any) +echo "starting rclone from nextcloud -> local storage" +/data/data/com.termux/files/usr/bin/rclone sync \ + $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ + $NC_ORG $LOCAL_ORG + +# pause to review rclone output +echo "press enter to continue" +read junkvar + +# release wake lock +/data/data/com.termux/files/usr/bin/termux-wake-unlock