26 lines
745 B
Bash
26 lines
745 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# The purpose of this script is to automatically empty our remote sandbox.
|
||
|
# This script is not to be run as root, rather as the user responsible for scanning.
|
||
|
|
||
|
# Only run if the user is not root
|
||
|
if [[ $USER = 'root' ]] ; then
|
||
|
echo "You must not run this script as root!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Set parameters
|
||
|
remote_path='https://cloud.kto.black/remote.php/webdav/Scans'
|
||
|
remote_user='scan'
|
||
|
remote_passwd='rB2TgFpNXk3BbZ44'
|
||
|
subdirectories_prefix='scans'
|
||
|
|
||
|
yesterday=$(date -d "-1 days" +"%Y%m%d")
|
||
|
today=$(date +"%Y%m%d")
|
||
|
|
||
|
curl -s -u $remote_user:$remote_passwd -X DELETE $remote_path/$subdirectories_prefix-$yesterday
|
||
|
curl -s -u $remote_user:$remote_passwd -X MKCOL $remote_path/$subdirectories_prefix-$today
|
||
|
|
||
|
echo "Cleaning done."
|
||
|
exit 0
|