added -j option

master
Nicholas Hope 2023-01-01 16:16:08 -05:00
parent 083850431c
commit d45ee35d23
1 changed files with 17 additions and 1 deletions

View File

@ -1,11 +1,27 @@
#!/bin/bash
LOCATIONS="nova singapore sydney dublin brazil"
SSHKEY="~/.ssh/id-paco-2022"
if [[ "$USER" == "nick" ]]; then
SSHKEY="~/.ssh/id-nick"
else
SSHKEY="~/.ssh/id-paco-2022"
fi
while getopts "j" arg; do
case "$arg" in
j )
JUST_ACCESS='true'
;;
esac
done
for location in ${LOCATIONS}
do
OUTDIR="logs/${location}"
[[ -d ${OUTDIR} ]] || mkdir -p ${OUTDIR}
if [[ -n "$JUST_ACCESS" ]]; then
scp -pr -i ${SSHKEY} "admin@${location}.nickhope.world:/var/log/apache2/access.log" ${OUTDIR}
else
scp -pr -i ${SSHKEY} "admin@${location}.nickhope.world:/var/log/apache2" ${OUTDIR}
fi
done