File: cron.monthly

package info (click to toggle)
ftpmirror 1.96+dfsg-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,080 kB
  • sloc: perl: 2,496; sh: 1,811; makefile: 51; ansic: 22
file content (48 lines) | stat: -rw-r--r-- 937 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# File: /etc/cron.monthly/ftpmirror
# Description: Cron script to save a log of ftpmirror tasks.
# Author: Dario Minnucci <debian@midworld.net>
# 

CONFIG_DIR=/etc/ftpmirror
LOG_FILE=/var/log/ftpmirror/ftpmirror.monthly

#
# Don't run if this package is removed but not purged
#
if [ ! -f /usr/sbin/ftpmirror ]; then
    exit 0
fi


#
# Logging section
#
if [ -x /usr/bin/savelog ]; then
    savelog -c 7 -m 644 -u root -g root $LOG_FILE >/dev/null
fi

exec >$LOG_FILE 2>&1


#
# Get package list from /etc/ftpmirror/list.monthly
#
PACKAGES=`cat ${CONFIG_DIR}/list.monthly | grep -v '#'`

for i in $PACKAGES; do

    TIMESTAMP=`date +"%Y-%m-%d %H:%M:%S"`

    echo ""
    echo "---------------------------------------------------------"
    echo " $TIMESTAMP - Package to process: $i"
    echo "---------------------------------------------------------"

    # Process parsed package
    /usr/sbin/ftpmirror $i

done

exit 0