forked from larsimmisch/capisuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapisuite.cronin
executable file
·49 lines (39 loc) · 1.29 KB
/
capisuite.cronin
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
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# CapiSuite cleanup script, should be run regularly
# by cron. It's only useful for the default scripts provided
# with CapiSuite.
#
# It will read a central configuration file placed in
# @pkgsysconfdir@/cronjob.conf where you must define variables
# which defines how many days a file may stay in the spool dirs
#
# Author: Gernot Hillier <[email protected]>
#
#
# paranoia settings
#
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
# make sure default values are set
MAX_DAYS_RCVD=0
MAX_DAYS_DONE=0
MAX_DAYS_FAILED=0
# do nothing if there is no global config
test -r @pkgsysconfdir@/cronjob.conf || exit
# read cronjob.conf
. @pkgsysconfdir@/cronjob.conf
if test "$MAX_DAYS_RCVD" -gt 0; then
for i in `find @spooldir@/users/ -mindepth 2 -maxdepth 2 -type d -name received`; do
find $i/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_RCVD -exec rm {} \;
find $i/. -name "*voice-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_RCVD -exec rm {} \;
done
fi
if test "$MAX_DAYS_DONE" -gt 0; then
find @spooldir@/done/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_DONE -exec rm {} \;
fi
if test "$MAX_DAYS_FAILED" -gt 0; then
find @spooldir@/failed/. -name "*fax-[0-9]*.*" ! -type d ! -type s -atime +$MAX_DAYS_FAILED -exec rm {} \;
fi
exit 0