aboutsummaryrefslogtreecommitdiff
path: root/blogsend
blob: 18b10a5502760ecb4317b1bef3b5c731bcd98466 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# 2025-03-29 15:36:12
# 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
rf=mail:/var/www/html/wittamore.com
mf=~/.local/src/web/wittamore.com
cd $mf || exit

# test if var is sent
if [ -z "$1" ]; then
   HOURS=1;
else
  # test if va is a number
  if [ "$1" -eq "$1" ]; then
    HOURS="$1";
  else
    HOURS=1;
  fi  
fi

MINUTES=$((HOURS*60))

echo "Sending files modified in the past $HOURS hour(s)..."

files=$(find -- * -iname "*.html" -path .tmp -prune -o -mmin -$MINUTES -type f) 
for file in $files 
do 
   scp -r "$file" "$rf/$file";
done

echo "Done."

exit 0