From ace8f40f8e098da8df251ae0e61114932af12b4a Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Sat, 17 May 2025 08:55:33 +0200 Subject: update --- blogsend | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/blogsend b/blogsend index c25da95..840c4bd 100755 --- a/blogsend +++ b/blogsend @@ -1,33 +1,34 @@ #!/bin/sh -# 2025-05-15 17:06:00 # blogsend : scp blog files to web server +# requires : pb https://git.wittamore.com/bashlib/tree/pb # usage : blogsend hours (if not set default is 1 hour) # example : blogsend 72 sends files modified over the past 3 days -# folders -# Add your remote ssh folder, ex. server:/var/www/html/whatever -rf= -# Add your local folder, ex. ~/web -mf= +source ~/.local/lib/pb +# folders +rf=mail:/var/www/html/wittamore.com +mf=~/.local/src/web/wittamore.com cd $mf || exit -# test $1 +# test if $1 if [ -z "$1" ]; then + printf %b "$(pb_fg 196)no parameter, using 1$(pb_nc)\n" hours=1; else - # test if var is a number + # test if $1 is a number if [ "$1" -eq "$1" ] >/dev/null 2>&1; then hours="$1"; else + printf %b "$(pb_fg 196)bad parameter, using 1$(pb_nc)\n" hours=1; fi fi minutes=$((hours*60)) -printf "\033[0;33mSending files modified in the past $hours hour(s) to $rf\033[0m\n" +printf "Sending files modified in the past $hours hour(s) to $rf\n" files=$(find -- * -iname "*.html" -path .tmp -prune -o -mmin -$minutes -type f) for file in $files @@ -35,7 +36,7 @@ do printf %s "-> "; scp "$file" "$rf/$file"; done -printf "\033[0;33mDone.\033[0m\n" +printf "Done.\n" exit 0 -- cgit v1.2.3