Add new sudo file rmbackup.sh as backups are owned by root currently

This commit is contained in:
Johannes Zellner
2016-10-10 16:10:34 +02:00
parent c129328828
commit f05a5226ba
3 changed files with 24 additions and 0 deletions

21
src/scripts/rmbackup.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -eu -o pipefail
if [[ ${EUID} -ne 0 ]]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
if [[ $# -eq 0 ]]; then
echo "No arguments supplied"
exit 1
fi
if [[ "$1" == "--check" ]]; then
echo "OK"
exit 0
fi
# remove the file
rm -rf "${1}"