nsbin/release_tmp

28 lines
469 B
Text
Raw Permalink Normal View History

#!/bin/sh -e
file="$1"
2019-04-12 16:18:39 +00:00
host=staticweb.ungleich.ch
dir=/home/services/www/nico/www.nico.schottelius.org/www/temp
2019-04-12 16:46:31 +00:00
url="https://www.nico.schottelius.org/temp"
delete_after=""
[ -z "$file" ] && exit 1
if [ "$file" = "-" ]; then
file=$(mktemp)
cat > "$file"
delete_after=yes
fi
bfile="$(basename "$file")"
2021-04-01 11:55:40 +00:00
scp -r "$file" "${host}:${dir}"
ssh "$host" "chmod a+r -R \"$dir/$bfile\""
if [ "$delete_after" ]; then
rm -f "$file"
fi
echo "${url}/${bfile}"