From 59fc618e95f90b61ef1fa86cf41771d9050b811a Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Thu, 15 May 2025 17:11:21 +0200 Subject: update --- blogsend | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/blogsend b/blogsend index 248f044..c25da95 100755 --- a/blogsend +++ b/blogsend @@ -1,40 +1,41 @@ -#!/usr/bin/env bash +#!/bin/sh +# 2025-05-15 17:06:00 # blogsend : scp blog files to web server # usage : blogsend hours (if not set default is 1 hour) # example : blogsend 72 sends files modified over the past 3 days # folders -# ex. server:var/www/html/whatever -rf=WEB_SITE_DIRECTORY -# ex. ~/.local/src/html -mf=LOCAL_DIRECTORY +# Add your remote ssh folder, ex. server:/var/www/html/whatever +rf= +# Add your local folder, ex. ~/web +mf= cd $mf || exit -# test if hours set +# test $1 if [ -z "$1" ]; then - HOURS=1; + hours=1; else # test if var is a number - if [ "$1" -eq "$1" ]; then - HOURS="$1"; + if [ "$1" -eq "$1" ] >/dev/null 2>&1; then + hours="$1"; else - HOURS=1; + hours=1; fi fi -MINUTES=$((HOURS*60)) +minutes=$((hours*60)) -echo "Sending files modified in the past $HOURS hour(s)..." +printf "\033[0;33mSending files modified in the past $hours hour(s) to $rf\033[0m\n" -files=$(find -- * -iname "*.html" -path .tmp -prune -o -mmin -$MINUTES -type f) +files=$(find -- * -iname "*.html" -path .tmp -prune -o -mmin -$minutes -type f) for file in $files do - scp "$file" "$rf/$file"; + printf %s "-> "; scp "$file" "$rf/$file"; done -echo "Done." +printf "\033[0;33mDone.\033[0m\n" exit 0 -- cgit v1.2.3