From: Edward Delaporte Date: Sun, 23 Aug 2026 22:40:30 +0000 (-0500) Subject: Add backup of wiki page X-Git-Url: https://apps.delaporte.us/gitweb/minion.git/commitdiff_plain/48041d616edc20520c0807432f79e606e2850fa0?hp=8e0d02d0883b04273b2d4ffb1205197ccd8c8b8b Add backup of wiki page --- diff --git a/bin/m2w b/bin/m2w new file mode 100755 index 0000000..51162b8 --- /dev/null +++ b/bin/m2w @@ -0,0 +1,37 @@ +#!/bin/bash +# m2w - minion send to wiki +# Will publish a maximum of four .md files to .md.txt files +# Meant for use wit Dokuwiki +# to $M2W_DIR on $M2W_SCP_HOST +year=`date +%Y` +files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md") + +if [ ! -n "$M2W_DIR" ]; then + echo "Set M2W_DIR" + exit 1 +fi + +if [ ! -n "$M2W_HOST" ]; then + echo "Set M2W_HOST" + exit 1 +fi + + +yearmonthday=`date -I` + +counter=0 +for file in $files; do + base=`basename $file .md` + # make a backup copy + scp $M2W_HOST:$M2W_DIR/$base.txt $HOME/Journal/archive-$year/wiki.backup.$base.$yearmonthday.txt + + # deploy file as .txt + scp $file $M2W_HOST:$M2W_DIR/$base.txt + counter=$((counter + 1)) +if [ $counter -gt 4 ]; then + echo "Aborting after 4 files." + echo "The following files would have been processed..." + echo $files + exit 1 +fi +done