Skip to content
Snippets Groups Projects
Verified Commit 7ddbf50b authored by David Hoese's avatar David Hoese
Browse files

Remove error checking for tmpwatch script and add mindepth

parent 348307c9
Branches
No related tags found
No related merge requests found
#!/bin/sh -e #!/bin/sh
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: ./tmpwatch.sh loop_sleep_seconds mtime dirs ..." echo "Usage: ./tmpwatch.sh loop_sleep_seconds mtime dirs ..."
...@@ -13,7 +13,8 @@ shift 2 ...@@ -13,7 +13,8 @@ shift 2
# Just keep going # Just keep going
while true; do while true; do
echo "`date +"%Y-%m-%d %H:%M:%S"` : Running tmpwatch to remove files older than $mtime days..." echo "`date +"%Y-%m-%d %H:%M:%S"` : Running tmpwatch to remove files older than $mtime days..."
find "$@" -"$TIME_MODE" $mtime -delete # mindepth 1: don't include the base directories as things to delete
find "$@" -mindepth 1 -"$TIME_MODE" $mtime -delete
echo "`date +"%Y-%m-%d %H:%M:%S"` : Done" echo "`date +"%Y-%m-%d %H:%M:%S"` : Done"
sleep $sleep_time sleep $sleep_time
done done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment