.
[ ]   [ ]  [ ȥå | | ñ측 | ǿ | Хåå | إ ]


// author:1
***Swatch󥹥ȡ :D

&font(b){SwatchȤϡ~};~
ꥢ륿˥ƻ뤷ꤷɤ˸ȥ~
Ȥ򤵤ƻġǤ

ѤưĶ
RedHatLinux9.0
ȥǥ쥯ȥ = /home/swatch

&font(b){Perl⥸塼Υ󥹥ȡ~};~
ǿǤˤƸڤȤSwatchưˤ5ĤPerl⥸塼뤬ɬפǤ

ɬפPerl⥸塼[[CPAN:http://search.cpan.org/]] ɤǽǤ

⥸塼̾ ڤѤС
Date::Manip (DateManip-5.44.tar.gz)
Date::Calc (Date-Calc-5.4.tar.gz)
Time::HiRes (perl-Time-HiRes-1.38-3.i386.rpm)
File::Tail (File-Tail-0.99.1.tar.gz)
Date::Parse (TimeDate-1.16.tar.gz)
swatch (swatch-3.1.1.tar.gz)

TimeHiRes(Time-HiRes-1.73.tar.gz) ⥸塼˴ؤƤtarballǥ󥹥ȡ뤬Ǥʤä "rpm" ˤƥ󥹥ȡ뤷ޤ~
(RedHat9.0CD-ROM2ܤƤˤޤ)

&font(b){Perl⥸塼Υ󥹥ȡ»~};~
Swatchưˤ줾Perl⥸塼򥤥󥹥ȡ뤷ޤ~
(֤θɬפ뤫⤷ޤ󤬡ꤢޤ)

[1] DateManipΥ󥹥ȡ
# cd /home/swatch
# tar xvfzp DateManip-5.44.tar.gz
# cd DateManip-5.44
# perl Makefile.PL
# make
# make install

[2] DateCalcΥ󥹥ȡ
# cd /home/swatch
# tar xvfzp Date-Calc-5.4.tar.gz
# cd Date-Calc-5.4
# perl Makefile.PL
# make
# make install

[3] TimeHiResΥ󥹥ȡ
# cd /home/swatch
# rpm -ivh perl-Time-HiRes-1.38-3.i386.rpm

[4] FileTailΥ󥹥ȡ
# cd /home/swatch
# tar xvfzp File-Tail-0.99.1.tar.gz
# cd File-Tail-0.99.1
# perl Makefile.PL
# make
# make install

[5] DateParseΥ󥹥ȡ
# cd /home/swatch
# tar xvfzp TimeDate-1.16.tar.gz
# cd TimeDate-1.16
# perl Makefile.PL
# make
# make install

&font(b){SwatchΥ󥹥ȡ~};SwatchΤPerl⥸塼Υ󥹥ȡˡȤۤѤޤ

swatchΥ󥹥ȡ
# cd /home/swatch
# tar xvfzp swatch-3.1.1.tar.gz
# cd swatch-3.1.1
# perl Makefile.PL
# make
# make install

&font(b){Swatch~};~
SwatchˤեΥץ뤬ޤޤƤΤǡΥץեΥǥ쥯ȥ˥ԡƤҤʷեȤѤޤǤSwatchե".swatchrc"Ȥ/root/ ֤ޤ

ҤʷեѤ
# cd /home/swatch/swatch-3.1.1/examples
# cp -pf swatchrc.personal /root/.swatchrc

POINT!!
/var/log/**** Υե¿ϡroot¤Ǥʤɹޤ
󡣰̥桼ǤSwatchư뤳ȤϲǽǤоݤΥե
ɼ긢¤ɬפȤʤޤ


ѥ󤪤ӥ~
եν񼰤ϰʲΤ褦ˤʤޤ

watchfor /ѥ/
1
2

ѥ~
ޥåǤդʸwatchforθ"/"ǶߵҤޤ~
ǵҤѥˤPerlɽѤ뤳ȤǽǤ

n~
ѥǥޥåνư򵭽Ҥޤ

[[Ϣȡѥ󤪤ӥ󵭽ҥ롼:http://www.atmarkit.co.jp/flinux/rensai/root04/root04b.html]]

&font(b){Swatchεư~};~
Swatchưδƻ򳫻Ϥޤ

(ư)
# /usr/bin/swatch -c /root/.swatchrc -t /var/log/messages >/dev/null 2>&1 &
& =Хå饦ɤˤƼ»

(ץǧ)
# ps aux |grep tail
root 3238 0.0 0.4 3904 588 pts/1 S 20:47 0:00 /usr/bin/tail-n 0 -f /var/log/messages

&font(b){Swatchμưưץ~};~
ưƤ"tail" kill 륹ץȤϲΤȤǤǸ˥ѡߥåѹ˺줺ˡ

(1) # vi /etc/rc.d/init.d/swatch ~
(2) # chmod 755 swatch

(ưưץ)
#! /bin/sh
#
# chkconfig: 2345 99 99
# description: tcpserver
# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

# See how we were called.
case "$1" in
start)
echo -n "Starting Swatch: "
/usr/bin/swatch -c /root/.swatchrc -t /var/log/messages >/dev/null 2>&1 &
RETVAL=$?
echo
;;

stop)
echo -n "Stopping Swatch: "
killproc tail
RETVAL=$?
echo
;;

restart)
$0 stop
$0 start
RETVAL=$?
;;

*)
echo "Usage: swatch {start|stop|restart}"
exit 1

esac
exit $RETVAL

&font(b){OSư˼ưŪΩ夲~};~
/etc/rc.d/ ʲ˥ܥå󥯤롣

(ư)
# cd /etc/rc.d/rc3.d
(ܥå󥯤κ)
# ln -s ../init.d/swatch ./S99swatch

ǵưswatchưŪΩ夬ޤ

&font(b){ơ};~
ƻ뤷ƤƵդȤϥơ󤵤ȸŤե򸫤ƤޤȤǤ򤹤뤿˰ʲ /etc/cron.daily/logrotate ɵޤ

# vi /etc/cron.daily/logrotate

#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
/etc/rc.d/init.d/swatch stop ɵ
/etc/rc.d/init.d/swatch start ɵ

  ʬ եź źեե   Wikiȥå ǽ Хåå   إ   ǽRSS
Expert Menu
ǿ
2020-8-6 2016-7-19 2016-5-31 2016-4-12 2016-4-5 2016-3-28 2016-3-10 2015-8-7
ʤ
Yahoo Japan
̤
ͧͤʹ
URLΤäƤ
¾Ȥ
ǿСγǧ

Linuxexpert is one of the service presented by InfomationSquare. / OmakaseBlog Login  |  Register Now!