File: tmpwatch.sh

package info (click to toggle)
jffnms 0.8.3dfsg.1-2.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,928 kB
  • ctags: 5,050
  • sloc: php: 19,981; sh: 266; makefile: 91; perl: 52
file content (29 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

basedir=$1;
hours="24";
dirs="$basedir/../htdocs/images/temp $basedir/temp $basedir/../logs";


tmpwatch="tmpwatch" #default location
tmpwatch_locations="/usr/sbin/tmpwatch /usr/local/sbin/tmpwatch";

for AUX in $tmpwatch_locations; do
	if [ -f $AUX ]; then
		tmpwatch=$AUX
	fi
done;

tmpwatch_cmd="$tmpwatch -c -f $hours";

for DIR in $dirs
do
    echo -n "Cleaning $hours hs. old files in $DIR ...";
    if [ -d "$DIR" ]; then
    	$tmpwatch_cmd $DIR
    	touch $DIR/.check
    	echo "done.";
    else 
	echo "error.";
    fi
done