aboutsummaryrefslogtreecommitdiff
path: root/local/bin/netsync
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-05-02 22:55:45 +0200
committerKarel Kočí <cynerd@email.cz>2018-05-02 22:55:45 +0200
commit2eb4a717a5db32b326d725cb7942127a01f549be (patch)
tree2d0a7f7be785e9fe230cf8e88c22a7b5851bc7f0 /local/bin/netsync
parent6c629ee7ac9b386e0e99c35044172e353cae1da3 (diff)
downloadmyconfigs-2eb4a717a5db32b326d725cb7942127a01f549be.tar.gz
myconfigs-2eb4a717a5db32b326d725cb7942127a01f549be.tar.bz2
myconfigs-2eb4a717a5db32b326d725cb7942127a01f549be.zip
WIP: replace syncemail with netsyncnetsync
Diffstat (limited to 'local/bin/netsync')
-rwxr-xr-xlocal/bin/netsync49
1 files changed, 49 insertions, 0 deletions
diff --git a/local/bin/netsync b/local/bin/netsync
new file mode 100755
index 0000000..b571e6e
--- /dev/null
+++ b/local/bin/netsync
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -e
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help)
+ echo "Usage: netsync [OPTION].."
+ echo "Group network synchronization script."
+ echo
+ echo "Options:"
+ echo " -h, --help"
+ echo " Print this help text."
+ echo " --tty"
+ echo " Spawn its own terminal window to run in"
+ exit 0
+ ;;
+ --tty)
+ # TODO dump log somewhere with timestamp
+ nohup urxvt -title "Network Sync" -e "$0" 2>&1 >/dev/null &
+ # TODO we might have to do some trickary here if we want more than
+ # just this one option.
+ exit 0
+ ;;
+ *)
+ echo "Unknown argument: $1" >&2
+ exit 1
+ esac
+ shift
+done
+
+EXIT_CODE=0
+
+run() {
+ if ! "$@"; then
+ EXIT_CODE=$?
+ echo -e "\e[1'31mCommand exited with: $EXIT_CODE\e[0m"
+ return $EXIT_CODE
+ fi
+}
+
+echo -e "\e[1;34m========== DAV discover ==========\e[0m"
+vdirsyncer discover
+echo -e "\e[1;34m========== DAV sync ==========\e[0m"
+vdirsyncer sync
+
+echo -e "\e[1;34m========== Mail ==========\e[0m"
+offlineimap
+
+# TODO also send mails now if there are some delayed mails (also confirm first?)