Hi everyone,

I made a shell script in /etc/periodic/daily/610.update-ports-tree and in my /etc/periodic.conf, this line : daily_update_ports_tree_enable="YES".


The problem is simple, my script doesn't start at all.

Can you help me please ?

Thank you :)


#!/bin/sh

# if there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
        . /etc/defaults/periodic.conf
        source_periodic_confs
fi

COUNTRIE=us
RETVAL=0
DATE=`date +%d/%m/%Y`
LOGFILE=/var/log/system-update-report.log

selectserver() {
        # Checking fastest cvs server
        server=`/usr/local/bin/fastest_cvsup -c $COUNTRIE | grep "1st" | \
        awk {'print $3'}`

        # Creating supfile
        sed "s/*default host=.*/*default host=$server/" \
        /usr/share/examples/cvsup/ports-supfile > /etc/ports-supfile
}

case "$daily_update_ports_tree_enable" in
        [Yy][Ee][Ss])

        # Begin
        selectserver

        # Fetching sources files
        /usr/bin/csup /etc/ports-supfile
        RETVAL=$?
        if [ $RETVAL != 0 ]
        then
                echo "-> $DATE - Ports tree: error while fetching sources 
files." \
                >> $LOGFILE
                exit 0
        fi

        # Creating INDEX.db file
        /usr/local/sbin/portsdb -Fu
        RETVAL=$?
        if [ $RETVAL != 0 ]
        then
                echo "-> $DATE - Ports tree: error while creating INDEX.db 
file" \
                >> $LOGFILE
                exit 0
        fi

        # Checking if applications needs to be updated
        LIST=`/usr/local/sbin/portversion -l "<"`
        RETVAL=$?
        if [ $RETVAL != 0 ]
        then
                echo "-> $DATE - Ports tree: error while checking updates" \
                >> $LOGFILE
                exit 0
        fi

        # Result
        if [ "$LIST" = "" ]
        then
                echo "-> $DATE - Ports tree: Up-To-Date" >> $LOGFILE
        else
                echo -e "-> $DATE - Ports tree: Up-To-Date. Here is list of \
                applications needs to be updated.\n\n$LIST" >> $LOGFILE
        fi
        *) rc=0;;
esac

exit $rc
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to