diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-15 17:11:21 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-15 17:11:21 +0200 |
commit | 59fc618e95f90b61ef1fa86cf41771d9050b811a (patch) | |
tree | 0b0516449565b9ac5abea9633841766fd7939833 | |
parent | 5aca10cf40030527c50b89522310e44de29cdf01 (diff) | |
download | blog-59fc618e95f90b61ef1fa86cf41771d9050b811a.tar.gz blog-59fc618e95f90b61ef1fa86cf41771d9050b811a.tar.bz2 blog-59fc618e95f90b61ef1fa86cf41771d9050b811a.zip |
update
-rwxr-xr-x | blogsend | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -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 |