’¢¢ fmirror ’¤Î’¥¤’¥ó’¥¹’¥È’¡¼’¥ë ’¡û green’¤Ë’¤Æ, root’¤Ë’¤Ê’¤Ã’¤Æ’ºî’¶È. ’¤Þ’¤ºfmirror ’¤Î’¥¤’¥ó’¥¹’¥È’¡¼’¥ë(apt’¤Î’Íø’ÍÑ) # apt-get install fmirror ’¢¢ fmirror ’¤Î’Àß’Äê fmirror’¤Î’Àß’Äê’¥Õ’¥¡’¥¤’¥ë’¤Ï /etc/fmirror ’¤Ë’ÃÖ’¤«’¤ì’¤ë. ’¤³’¤³’¤Ë’¤Ï’¼Â’ºÝ’¤Ë’¥ß’¥é’¡¼’¥ê’¥ó’¥°’¤ò’¹Ô’¤¦’ºÝ’¤Î’Àß’Ä꒤Ȓ¥ß’¥é’¡¼’¥ê’¥ó’¥°’¤Î ’¼Â’¹Ô’¤ò’µ­’½Ò’¤·’¤¿’¥·’¥§’¥ë’¥¹’¥¯’¥ê’¥×’¥È’¤Ç’¤¢’¤ë *.conf ’¥Õ’¥¡’¥¤’¥ë’¤È, cron ’¤Ë’¤è’¤ë’¼«’ư’¥ß’¥é’¡¼’¥ê’¥ó’¥°’¤ò’°Õ’¼±’¤·’¤¿ config ’¥Õ’¥¡’¥¤’¥ë’¤¬’¤¢’¤ë. ’¡û debian.conf’¤Î’Àß’Äê ’¤Þ’¤º’¤Ï devian.conf ’¤ò’Àß’Äê’¤¹’¤ë. # cd /etc/fmirror # vi debian.conf ’¤³’¤ì’¤ò’°Ê’²¼’¤Î’¤è’¤¦’¤Ë’Àß’Äê. (<*>’¤Ï’½ñ’¤­’ÊÑ’¤¨, ’¤¢’¤ë’¤¤’¤Ï’½ñ’¤­’²Ã’¤¨’¤¿’¤È’¤³’¤í) =============================================================================== # mirror debian username: anonymous password: tsubasa@ep.sci.hokudai.ac.jp <*> host: ftp.jp.debian.org <*> remotedir: / <*> localdir: /home/ftp/common/Linux/ <*> #loglevel: 1 compressed: 1 decompressor: gzip decompressor_opt: -dc dircmd: RETR ls-lR.gz # the normal excludes first exclude: f ^(\.in\.|\.mirror|core$|MIRROR\.LOG|\.notar|\.message) exclude: f ^(\.cache|\.zipped|lost\+found|Network Trash Folder) exclude: p ^(bin/|etc/|lib/) <*> # exclude the uncompressed Contents and Packages files, and all ls-lR files include: if Packages-.*\.gz$ include: if Contents-.*\.gz$ exclude: if Contents- exclude: if Packages- exclude: if ls-lR # dont get source exclude: p (^|/)source/ # get binaries only for intel, and all include: p (^|/)(disks|binary)-(all|i386)/ exclude: p (^|/)(msdos|disks|binary)-.*/ exclude: if _(alpha|m68k|sparc|powerpc)\.deb$ =============================================================================== ’¢¨’¤³’¤³’¤Ç, /home/ftp ’°Ê’²¼’¤Ë /common/Linux ’¤ò’ºî’À®. ’¡û config ’¤Î’Àß’Äê ’¤³’¤Á’¤é’¤Ï cron ’¤Ë’¤è’¤ë’¥ß’¥é’¡¼’¥ê’¥ó’¥°’¤Î’¤¿’¤á’¤Î’³Æ’¼ï’´Ä’¶­’ÊÑ’¿ô’¤Î’Àß’Äê’¤ò’¹Ô’¤Ã’¤Æ’¤¤’¤ë. # vi config ’¤³’¤ì’¤ò’°Ê’²¼’¤Î’¤è’¤¦’¤Ë’Àß’Äê. (<*>’¤Ï’½ñ’¤­’ÊÑ’¤¨, ’¤¢’¤ë’¤¤’¤Ï’½ñ’¤­’²Ã’¤¨’¤¿’¤È’¤³’¤í) =============================================================================== # # configuration file for run_fmirror # # this is a bash shell script which is sourced by /usr/lib/fmirror/run_fmirror # # The variables you may change in this config file are: # RUN_IN_BACKGROUND, NUMLOGS, NIGHTLY_JOBS, and DAY[0..6] # do you want the mirror jobs to be run simultaneously? 0=false, 1=true RUN_IN_BACKGROUND=1 # how many days worth of old log files do you want to keep ? NUMLOGS=7 # do not change the following line. TODAY=$(date +%w) # list the basename(s) of each mirror job to run. # # each mirror job has a configuration file in /etc/fmirror, with the # filename of .conf. List only the job names here, without the # .conf extension. # # Note: the quotes ("") are essential. # jobs to be run every night. Start time is specified in /etc/cron.d/fmirror. #NIGHTLY_JOBS="debian debian-incoming debian-non-US" NIGHTLY_JOBS="debian debian-incoming debian-nonus" <*> # jobs to be run only on specific days. 0=Sun, 1=Mon, ..., 6=Sat # # note: do NOT list jobs in both NIGHTLY_JOBS and in DAY[0..6] otherwise # the job will be run twice simultaneously. DAY[0]="debian" <*> DAY[1]="" DAY[2]="" DAY[3]="" DAY[4]="" DAY[5]="" DAY[6]="" # do not change the following lines. JOBS="$NIGHTLY_JOBS ${DAY[$TODAY]}" # delete any duplicate entries JOBS=$(echo $JOBS | xargs -n 1 echo | sort -u) # if set, nightly logs are mailed to the specified user(s) #MAILTO=root =============================================================================== ’¤³’¤³’¤Ç’ÊÑ’¿ô NIGHTLY_JOBS ’¤Ë’»Ø’Äê’¤·’¤¿’ʸ’»ú’Îó’¤Ë .conf ’¤ò’ÉÕ’¤±’¤¿ ’̾’Á°’¤Î’¥Õ’¥¡’¥¤’¥ë’¤¬ cron ’¤Ë’¤è’¤ë’¥ß’¥é’¡¼’¥ê’¥ó’¥°’¤Î’Àß’Ä꒤˒ÍÑ’¤¤’¤é’¤ì’¤ë ’¤³’¤È’¤Ë’¤Ê’¤ë. ’¤³’¤³’¤Ç’¤Ï debian debian-incoming debian-nonus ’¤È’¤Ê’¤Ã’¤Æ’¤¤’¤ë’¤¿’¤á debian.conf, debian-incoming.conf, debian-nonus ’¥Õ’¥¡’¥¤’¥ë’¤¬’»È’¤ï’¤ì’¤ë. ’¤¿’¤À’¤· debian ’¤Ï’ÍÆ’ÎÌ’¤¬’Èó’¾ï’¤Ë’Âç’¤­’¤¤’¤¿’¤á ’Ëè’Æü’¥ß’¥é’¡¼’¤»’¤º, ’Ëè’½µ’Æü’ÍË’Æü’¤Î’¤ß’¥ß’¥é’¡¼’¤ò’¹Ô’¤¦’¤è’¤¦’¤Ë’¤·’¤¿’¡£ ’¡û cron ’¤Ë’¤è’¤ë’¼«’ư’²½ UNIX ’¤Ë’¤Ï’Äê’´ü’Ū’¤Ë’¹Ô’¤¦’ºî’¶È’¤ò’¼«’ư’Ū’¤Ë’¹Ô’¤¦’¤¿’¤á’¤Î cron ’¤È’¤¤’¤¦ ’¥Ä’¡¼’¥ë’¤¬’ÍÑ’°Õ’¤µ’¤ì’¤Æ’¤¤’¤ë. ’¤µ’¤é’¤Ë debian ’¤Ç’¤Ï /etc/cron.daily/, /etc/cron.weekly/ ’¤È’¤¤’¤Ã’¤¿’¥Õ’¥©’¥ë’¥À’¤ò’ÍÑ’°Õ’¤·’¤Æ’¤¤’¤ë. ’¤³’¤ì’¤é’¤Î’¥Õ’¥©’¥ë’¥À’¤Ë’³Ê’Ǽ’¤µ’¤ì’¤¿’¥×’¥í’¥°’¥é’¥à’¤ò’¤½’¤ì’¤¾’¤ì’Ëè’Æü, ’Ëè’½µ’¼Â’¹Ô ’¤¹’¤ë’¤³’¤È’¤Ç’Àß’Äê’¤ò’´Ê’ñ’¤Ë’¤·’¤Æ’¤¤’¤ë. fmirror ’¤Î’¼Â’¹Ô’¥¹’¥¯’¥ê’¥×’¥È’¤Ï /etc/cron.daily ’¤Ë’³Ê’Ǽ. # vi /etc/cron.daily/fmirror ’¤³’¤ì’¤ò’°Ê’²¼’¤Î’¤è’¤¦’¤Ë’Àß’Äê. =============================================================================== # ! /bin/bash # /etc/cron.daily/fmirror # # run the scheduled fmirror # # Author: Craig Sanders # # Copyright status: This script is copyright and licensed under the # terms of the GNU General Public License. #set -x confdir=/etc/fmirror logdir=/var/log/fmirror # if logdir doesn't exist then create it. [ -d $logdir ] || mkdir -p $logdir # read in the config file . $confdir/config # allow command line override of which jobs to run if [ -n "$1" ] ; then MIRRORS="$@" else MIRRORS=$JOBS fi # strip off .conf in case the user has ignored the instructions in # /etc/fmirror/config saying to list only the base name. MIRRORS=$(echo $MIRRORS | sed -e 's/\.conf//') do_it() { run=/var/run/fmirror.$1 if [ ! -e $run ] ; then touch $run tmpfile=`tempfile --name /tmp/fmirror.log.$1.$$.$(date +%s)` LOG=$logdir/$1.log ( [ -e $LOG ] && savelog -c $NUMLOGS $LOG # run the mirror job rm -f ls-lR ls-lR.gz conf="$confdir/$1.conf" fmirror -f $conf >/dev/null # create the local ls-lR.gz file localdir=`grep -i "^localdir:" $conf | cut -f2` cd $localdir # use full path to ls, just in case it is aliased to 'ls -F' or # something. /bin/ls -lR >ls-lR gzip -9f ls-lR ) >$tmpfile 2>&1 if [ -n "$MAILTO" ] ; then cat $tmpfile | mail $MAILTO fi rm -f $run mv $tmpfile $LOG fi } for i in $MIRRORS ; do if [ "$RUN_IN_BACKGROUND" = "1" ] ; then do_it $i & else do_it $i fi done ===============================================================================