Created
August 5, 2016 08:33
-
-
Save ice2heart/5ceec200740a648c3a092b9c9de0871f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#0 */2 * * * /home/jenkins/expire.sh # in crontab -e | |
DIR=/home/ice/tmp/56866493 | |
FILES="*.mp4" | |
let "EXPIRETIME=172800" # expire time in seconds | |
cd $DIR | |
for f in $FILES | |
do | |
NOW=$(date +%s) | |
FCTIME=$(stat -c %Y "$f") | |
let AGE=$NOW-$FCTIME | |
if [[ $AGE -gt $EXPIRETIME ]] ; then | |
rm -f "$f" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment