aboutsummaryrefslogtreecommitdiff
path: root/blogsend
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-15 17:11:21 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-15 17:11:21 +0200
commit59fc618e95f90b61ef1fa86cf41771d9050b811a (patch)
tree0b0516449565b9ac5abea9633841766fd7939833 /blogsend
parent5aca10cf40030527c50b89522310e44de29cdf01 (diff)
downloadblog-59fc618e95f90b61ef1fa86cf41771d9050b811a.tar.gz
blog-59fc618e95f90b61ef1fa86cf41771d9050b811a.tar.bz2
blog-59fc618e95f90b61ef1fa86cf41771d9050b811a.zip
update
Diffstat (limited to 'blogsend')
-rwxr-xr-xblogsend31
1 files 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