Fix bugs due to no variable-quoting in meetbot scripts, and fix shellcheck warnings on them

Signed-off-by: Rick Elrod <relrod@redhat.com>
This commit is contained in:
Rick Elrod 2020-06-14 01:44:35 -05:00 committed by Rick Elrod
parent 3569ba2d8c
commit 7bb8ee6fef
2 changed files with 9 additions and 11 deletions

View file

@ -1,8 +1,8 @@
#!/bin/bash
cd /srv/web/meetbot/teams
cd /srv/web/meetbot/teams || exit
for team in *; do
pushd $team >/dev/null 2>&1
tar -cphf /srv/web/meetbot/archives/$team.tgz *.log.txt
popd >/dev/null 2>&1
pushd "$team" >/dev/null 2>&1 || { echo "Refusing to process non-directory: /srv/web/meetbot/teams/$team"; continue; }
tar -cphf "/srv/web/meetbot/archives/$team.tgz" ./*.log.txt
popd >/dev/null 2>&1 || { echo "Something really weird happened and popd failed. Aborting."; continue; }
done

View file

@ -1,13 +1,11 @@
#!/bin/bash
BASELOCATION=/srv/web/meetbot/teams
cd $BASELOCATION
cd ..
cd "$BASELOCATION/.." || exit
for f in `find -type f -mtime -30 | grep -v "fedora-meeting\."`
for f in $(find . -type f -mtime -30 | grep -v "fedora-meeting\.")
do
teamname=$(basename $f | awk -F. '{ print $1 }' )
mkdir -p $BASELOCATION/$teamname
ln -f -s $PWD/$f $BASELOCATION/$teamname/
teamname="$(basename "$f" | awk -F. '{ print $1 }' )"
mkdir -p "$BASELOCATION/$teamname"
ln -f -s "$PWD/$f" "$BASELOCATION/$teamname/"
done