bin sh CHECK_UPTODATE yes AUTO_UPDATE_AGENTS yes MYMAIL xxxxxx MAILSER

 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
#!/bin/sh
CHECK_UPTODATE="yes";
AUTO_UPDATE_AGENTS="yes";
MYMAIL="xxxxxx";
MAILSERVER="xxxxx"
MAILBIN="/usr/bin/mail";
GREPBIN="/usr/bin/grep";
PKG_VERBIN="/usr/sbin/pkg_version";
SUPFILE="/usr/scripts/supfile";
SUPFILE_PORTS="/usr/scripts/supfile-ports";
CSUPBIN="/usr/bin/csup";
CSUPLOGDIR="/var/log/";
DATE="`/bin/date +%Y-%m-%d`";
UPDATE_KEY = "/usr/src/last_update";
LOGFILE="/var/log/csup-$DATE.log"
IPFWBIN="/sbin/ipfw"
$IPFWBIN delete 18613
$IPFWBIN add 18613 allow tcp from any to any dst-port 5999 setup keep-state
$IPFWBIN add 18613 allow tcp from me to $MAILSERVER out dst-port 25 setup keep-state
$CSUPBIN -g -L 2 -z $SUPFILE >> $LOGFILE
$CSUPBIN -g -L 2 -z $SUPFILE_PORTS >> $LOGFILE
CNT="`$GREPBIN -E '(Edit|Delete|Checkout|Rejected|refused)' $LOGFILE`";
echo $CNT;
if [ -z "$CNT" ]
then
echo "No Updates" >> $LOGFILE
else
# $GREPBIN -E '(Edit|Delete|Checkout|Rejected|refused)' $LOGFILE | $MAILBIN -s Updates $MYMAIL
$GREPBIN -E '(Edit|Delete)' $LOGFILE | $MAILBIN -s Updates $MYMAIL
fi
#$IPFWBIN delete 18613