-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_one
More file actions
executable file
·37 lines (27 loc) · 847 Bytes
/
validate_one
File metadata and controls
executable file
·37 lines (27 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Logical flow:
#
# Find the oldest validated file
# Go to the folder containing that validated file.
# Push the download to the back of the line to avoid collisions
# Check the sha256sums file, results into validated file, details to log.
BASEDIR=/srv/hackgrab
HOSTNAME=`hostname`
cd ${BASEDIR}/content
TORUN=`ls -tr */validated | head -n1`
FOLDER=`dirname "${TORUN}"`
echo "Validating ${FOLDER}" > ${BASEDIR}/metadata/status_${HOSTNAME}
echo -n "${HOSTNAME} started validation on ${FOLDER} at "
date +"%Y-%m-%d %H:%M:%S"
cd "${BASEDIR}/content/${FOLDER}"
touch validated
if sha256sum --check sha256sums
then
echo "SUCCESS" > validated
else
echo "FAILURE" > validated
fi
echo -n "${HOSTNAME} completed validation on ${FOLDER} at "
date +"%Y-%m-%d %H:%M:%S"
echo
echo "Idle" > ${BASEDIR}/metadata/status_${HOSTNAME}