Next Previous Contents

4. §ïÅܬY¨Ç¤@¯ëªº¨t²Î³]©w

¦b§Ú®³¨ì Linux ¨Ã¦b§Úªºµ§°O¹q¸£¤W¦w¸Ë¡B°õ¦æ«á¡A §Úµoı¥¦·|¨C´X¬í´N ·|¦s¨ú¤@¦¸µwºÐ¡A´Nºâ¨Ã¨S¦³¥ô¦óªº¨Ï¥ÎªÌñ¤J¨t²Î¤º! ³o´N¬OµwºÐ¥i¯à´N ±q¨S¦³¶i¤J¥¦ªº¯à·½¬Ù¹q¼Ò¦¡¡C¯à°÷´î¤ÖµwºÐªº°Ê§@ªº¸Ü´N¥i¥H«Ü©úÅã¦a¼W ¥[¹q¦Àªº¨Ï¥Î®É¶¡¡A¥H¤U¬O§Ú©Ò»`¶°ªº°t¤è¡C

§Ú¨Ï¥Î RedHat 4.1 ´ú¸Õ¤F©Ò¦³ªº¤èªk¡A¦³¨Ç«Øºc³]©wªº¦a¤è¥i¯à·|»P§A©Ò ¨Ï¥Îªº Linux ¨ÑÀ³ª©¥»¤£¦P¡C(¦pªG¯u¦p¦¹¡A½Ð±zÅý§Úª¾¹D¡C)

4.1 crond ºëÆF»P atrunºëÆF

½ÐÀˬd§Aªº /etc/crontab Àɮ׬ݬݬO§_¥¦·|¦b¨C¤ÀÄÁ°Ê§@¤@¦¸ ¡C§A·|¬Ý¨ì atrun ±`·|¥X²{¦bùØ­±¡C

¨Ï¥Î at ©R¥O¥i¥HÅý§A±N¥¼¨Ó­n°µªº©R¥O©ñ¦b©R¥O°±«Ý°Ï¤º¡A ®É¶¡¨ì ¤F´N·|°õ¦æ¥¦­Ì¡C ¦³¨Ç Linux ¨t²Î¨Ï¥Î¦Û­qªº atd ºëîú¨Ó°µ³o­Ó¤u §@¡A ¨ä¥Lªº (¨Ò¦p RedHat) Åý crond ºëÆF¨C¤ÀÄÁ°õ¦æ atrun ¤@¦¸¡C

¤j³¡¥÷ªº¨t²Î¤W¬O§_»Ý¦p¦¹°µªº¡A ¦]¬° at ©R¥O«Ü¤Ö·|¨Ì¿à¤@©wªº®É ¶¡¤º³Q°õ¦æ¡A ¦]¦¹¦pªG§A¦b§Aªº /etc/crontab Àɮפºµo²{¤U­± ³o¦æ:

# Run any at jobs every minute
* * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun

§A´N¥i¥H¦w¥þ¦a§â¥¦§ï¦¨:

# Run any at jobs every hour
00 * * * * root [ -x /usr/sbin/atrun ] && /usr/sbin/atrun

²Ó¸`½Ð¾\Ū man 5 crontab¡C ¦³¨Ç¤H´Nºâ¦b¨S¦³°õ¦æ crond ºë ÆF¤UÁÙ¬O¥i¥H°Ê§@¡A¦]¦¹¦pªG§Aª¾¹D§A¦b°µ¤°»ò¡A§A¥i¥H¦Ò¼{§¹¥þ¦a§â¥¦µ¹ Ãö³¬±¼¡C

4.2 update / bdflush ºëÆF

Linux ¦b¥ô¦ó®É­Ô³£¦b³B²zµÛ«Ü¦hªº¤w¶}±ÒÀɮתº½w½Ä°Ï¡A¨Ó°µ¨t²Î«Ü½T»{ Àɮצ³¥ô¦ó§ïÅܮɯà°÷·U§Ö¦sÀÉ·U¦n¡A¤£µMµ¥¨ì¨t²Î·í¾÷®É¤w°µªº§ïÅÜ´N·| ¤£¨£¤F¡C

update / bdflush ºëÆF´N¬O¥Î¨Ó·ÓÅU³o¥ó®Éªº¡C(³o¬O¦P¤@­Óµ{ ¦¡ªº¨â­Ó¦W¦r¡A ¦]¦¹§A¥i¥H¨Ï¥Î¨â­Ó¨ä¤¤ªº¤@­Ó¦W¦r¨Ó±Ò°Ê³o­ÓºëÆF¡C ) ­ì¨Óªº³]©w·|Åý³o­ÓºëÆF¨C 5 ¬íÄÁ©I¥s flush ¥H¤Î¨C 30 ¬íÄÁ©I¥s sync ¤@¦¸¡C

¦b§Úªº Fujitsu ´I¤h³qºÏºÐ¤W·|³y¦¨¤£°±ªº¦s¨ú¡C(¦n¹³³o­ÓµwºÐ´Nºâ¸ò¥» ¤°»ò¤]¨S§ïÅܪºª¬ªp¤U·|±N¥¦ªº°O¾ÐÅé§Ö¨úµ¹²M°£±¼¡C¦ý³o­n¬Ý§AªºµwºÐªº °bÅé: ¦³¨ÇªB¤Í§i¶D§Ú»¡´Nºâ¨S¦³°µ¹³¤U­±¨º¼Ëªº­×§ï¥L­ÌªºµwºÐÁÙ¬O¥i¥H ¶i¤J¥»¨­ªº¬Ù¹q¼Ò¦¡¤U¡C)

¦]¬° Linux ¨Ã¹³¥H«e¨º¼Ë±`·í¾÷¤F¡A §Ú´N±N¨â­Ó¼Æ­È³£§ï¦¨¬° 3600 ¬í (=1 ¤p®É )¡C³o¼Ë¤@ÂI¤]¤£·|³y¦¨¥ô¦ó°ÝÃD¡A¦Ó¥B­ì¥»±`·|¦³ªººÏºÐ¦s¨ú°Ê §@´N°±¤î¤F¡C (¦ý¬O¦pªG§Úªº¨t²Î²{¦b·í¾÷¤F¡A·íµM¤@©w·|¦³³\¦h¯}·lªºÀÉ ®×¤F¡C)

RedHat 4.1: ¦b /etc/inittab ¤º¡A±N update ©I¥s§ï¦¨:

ud::once:/sbin/update -s 3600 -f 3600

Suse 4.4.1: update is called in /sbin/init.d/boot.

Slackware: update is called in /etc/rc.d/rc.S.

See man update for details.

4.3 syslogd ºëÆF

syslogd ºëÆF­t³d«Ü¦h¦b /var/log/ ¥Ø¿ý¤º¥i§ä¨ìªº Linux ¨t²Î¤é»xÀɮסC­ì©w syslogd ·|¦b¨C¦¸¦³¨t²Î°T®§³Q°O¿ý®É¦P ¨B¦s¨ì¤é»xÀɮפº¡C

§A¥i¥H¦b /etc/syslog.conf ¤º¨Ï¥Î±×¸¹ / ±µ¦bÀɮצWºÙ«e±N³o ­Ó¥\¯àÃö³¬¡C¥H¤U¬O§Ú¦b§Úªº¨t²Î¤º§ä¨ìªº syslog.conf¨Ò¤l:

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none -/var/log/messages

¦P¼Ëªº¡A¦pªG·í¨t²Î·í¾÷®É¡A°ÝÃD°T®§¬O¤£·|³Q¦s¨ìºÏºÐ¤ºªº¡CDilemma...

4.4 init ©R¥O

¦b¶}¾÷®É¡A ªì©l®Éªº³B²zµ{¦¡¥H¤ÎºëÆF­Ì¬O¸g¥Ñ init ©R¥O¨Ó¶}©l°õ ¦æªº¡C³o­Ó©R¥O (¤S¬O¥¦ ) ¦b¨C¦¸¥¦©Ò«Ø¥ßªº³B²zµ{¦¡«e·|©I¥s sync¡C

§A¥i¥H¦b­ì©lµ{¦¡½X¤¤±N³o­Ó sync() ©I¥sµ¹²¾¨«¡AµM«á¦A­«·s½sĶ ¥¦¡C

­nÁקKµo¥ÍÀÉ®×½w½Ä¿ò¥¢ªº°ÝÃD¡A§AÀ³¸Ó¦b§Aªº¨t²Îªº /etc/rc.d/init.d/halt ©R¥O¤â½Z¤º¦b¨ø¤UÀɮרt²Î«e¥[¤W¹ï sync ªº©I¥s¡C

4.5 swap ºÏ°Ï

Linux swap ºÏ°Ï¬O¥Î¨Ó¥HµêÀÀ°O¾ÐÅ骺¤è¦¡¨Ó¼W¥[¹êÅé°O¾ÐÅ骺ªÅ¶¡¡C ³o ¤]¬OµwºÐ·|¦s¨úªº¥i¯à­ì¦]¡C¦pªG§Aªºµ§°O¹q¸£¤w¸g¦³³\¦h°ÊºA°O¾ÐÅé RAM ¤F©Î¬O§A¨Ï¥Î«Ü²³æªºÀ³¥Îµ{¦¡ (·Q¨ì vi)¡A ±z¥i¥H¦Ò¼{§â¥¦µ¹Ãö³¬ ¡C

³o·íµM­n¬Ý§A¥´ºâ°µ¤°»ò¡C4 ¨ì 8 MB ¨Ã¤£¨¬°÷¡A³o®É§A¸Ó¨Ï¥Î swap ºÏ°Ï ¡C¦³ 8 ¨ì 16 MB ®É¡A¤å¦rµe­±¦¡ªºÀ³¥Îµ{¦¡¥i¥H«Ü¦n¦a¤u§@¡A¦pªG§A¯àÁ× §K¨Ï¥Î¤Ó¦hªº¦h¤u¥\¯à¡A §A¥i¥H¦w¥þ¦a§â swap ¥\¯àµ¹Ãö±¼¡C X-Windows Àô¹Ò»Ý­n«Ü¦hªº°ÊºA°O¾ÐÅé¡A§A³Ì¦n¤£­n¦b¨S¦³ swap ¤U¨Ï¥Î¥¦¡A°£«D§A¦³ 16MB ¥H¤W¡C

(ªþµù: §Ú¨º¥x¦³ 16 MB ªºµ§°O¹q¸£¦bÃö³¬ swap ºÏ°Ï¤U¥i¥H°õ¦æ¤@­Ó emacs ¤u§@¡B 4 ­Ó bash shells ÁÙ¦³½sĶ¤@­Ó®Ö¤ß³£¨S¦³µo¥Í °O¾ÐÅ餣°÷ªº±¡ªp¡C³o¹ï§Ú¨Ó»¡´N°÷¤F¡C)

¦pªG§A¤w¸g¦w¸Ë swap ºÏ°Ï¤F¡A§A¥i¥H¦b /etc/rc.d/rc.sysinit ¤ºªº swapon ©R¥O«e¥[­Ó hash ²Å¸¹§Y¥i§â¥¦µ¹Ãö³¬¡C ¦pªG§A¤£·Q§â ¥¦¥Ã»·¦a²¾°£¡A¨º´NÅý¨t²Î¦b¶}¾÷®É°Ý§A¬O§_­n¨Ï¥Î swap ºÏ°Ï¡C¦b /etc/rc.d/rc.sysinit (RedHat 4.1) ©Î /sbin/init.d/boot (Suse 4.4.1)ùØÀY:

echo "Should the system use swap?"
echo "  0: No."
echo "  1: Yes."
/bin/echo "Your choice: \c"
read SWAPCHOICE

case "$SWAPCHOICE" in
    0)
        # Do nothing.
        echo "(Swap partitions disabled)"
        ;;
    *)
        # Start up swapping.
        echo "Activating swap partitions"
        swapon -a
esac

¨º»ò§A´N¥i¥H¦b¨Ï¥Î¥æ¬y¹q·½®É¶}±Ò swap ºÏ°Ï¡A¦Ó¨Ï¥Î¹q¦À¬O´N·|Ãö³¬¨¥ ³o¥\¯à¡C

4.6 apache httpd ºô­¶¦øªA¾¹ºëÆF

§Ú¨Ï¥Î§Úªºµ§°O¹q¸£¨Óµo®i¡B´ú¸Õµ¹ºô¯¸¨Ï¥Îªº cgi ©R¥O¤â½Z¡A ³o¤]´N¬O ¬°¤°»ò§Ú¦b¥¦¤W­±¬[¤F­Ó°Ï°ìºô¯¸ªº­ì¦]¡C¦pªG§A³Ì·Q°µªº¥u¬O¦³®É­Ô¥Î¨Ó ´ú¸Õ¤@­Ó©R¥O¤â½Z©Î¬OÀˬd¬Y­Óºô­¶¦Ó¤w¡A¨º»ò¼Ð·Çªº«Øºc¦ü¥G¬O¤Ó¦h¤F¡C

¦b httpd.conf ùØ¡A¥u­n§â MinSpareServers ¥H¤Î StartServers ªº­È§ï¦¨ 1¡C ³o¹ï¥»¦aºÝªº´ú¸Õ¯¸¤w¸g«Ü°÷¤F¡C

¦pªG§A·QÃö³¬ºô¯¸¦øªA¾¹ªºÃ±¤J¡A§A¥²¶·­«·s½sĶ httpd ºëÆF¡A²Ó¸` ½Ð¾\Ū¤å¥ó¡C

Grant Taylor ­«·s½sĶ¤F apache ªºÃ±¤J«áµoı³o¼Ë¤l `` ¨Ã¤£·|Åý¥¦°± ¤î churning ºÏºÐ¡C ©Ò¥H§Ú¨Ï¥Î¥t¤@­Ó¡A IMHO ¤ñ¸û¦nªº¸Ñ¨M¤èªk: §Ú§â apache «Øºc¦¨±q inetd ¨Ó°õ¦æ¨ú¥N­ì¥»¥Ñ¦Û¤v¨Ó¡C '' ²Ó¸`½Ð¾\Ū man inetd¡C

4.7 XFree86 ®M¥ó

¬°µ§°O¹q¸£«Øºc XFree86 ¬O¥t¤@­Ó¸ÜÃD¤F¡A ¦A¦¸¡A§Ú¥²¶·½Ð§A°Ñ¦Ò Linux µ§°O¹q¸£ºô­¶¡A¦b¨º¨à§A¥i¥H§ä¨ì«Ü¦hªº¨ó§U

X ªº±±¨î¥x¦bªÅ¥Õ®É¥u·|§â¿Ã¹õÅܦ¨¶Â¦â¡A ¦ý¨Ã¤£¬O§â¥¦Ãö±¼¡C ´N¦p¦P¦b ³ÆµùÃö©ó±±¨î¥xÅܦ¨ªÅ¥Õ ¤¤´£¨ìªº¡A§A¥i¥H¨Ï¥Î xset ªº dpms ¿ï¶µ¨Ó§ïÅÜ¥¦¡CµM¦Ó¡A³o¶µ ¥\¯à±o¬Ý§Aªºµ§°O¹q¸£ªºÃ¸¹Ï´¹¤ù¥H¤Î bios ¤F.

Grant Taylor ¨Ï¥Î¥H¤Uªº³]©w¥H¤Î apmd ©M¿Ã¹õ«OÅ@µ{¦¡ªº¨ó§U¨Ó¶Ç °e¨Ï¥Lªºµ§°O¹q¸£¶i¤JºÎ¯vª¬ºA¡C

# Run xscreensaver with APM program
xscreensaver -timeout 5 \
             -xrm xscreensaver.programs:apm_standby \ 
             -xrm xscreensaver.colorPrograms:apm_standby &

³o­Ó ``apm_standby ¬O­Ó¥u¤¹³\¯S©w¤H¤h¨Ó°õ¦æ apm -S ªº suid perl ¤â½Z¡C''

4.8 emacs ½s¿èµ{¦¡

¦nªº¡A emacs ¨Ã«D¤£¬O­Ó½s¿è¾¹¡A ¦ý¬O­Ó¥Í¬¡¤è¦¡¡C ¥H¤U¬O¥Ñ Florent Chabaud ´£¨Ñªº±K³Z: `` ¦pªG§A¨Ï¥Î emacs¡A¤]³\§A¤wµo²{ ¨ì³o­Ó½s¿è¾¹·|°µ¦Û°Ê¦sÀɪº°Ê§@¡A ·íµM³o«Ü¦³¥Î¦Ó¥B¤] ¤£¸Ó §â ¥¦Ãö±¼¡A¦ý­ì¥»¤º©wªº°Ñ¼Æ¥i¥H³Q­×§ï¨Ó°w¹ïµ§°O¹q¸£ªº¨Ï¥Î¡C

§Ú¦b /usr/share/emacs/site-lisp/site-start.el Àɮפº¥[¤J ¤F¤U¦C´X¦æ:

(setq auto-save-interval 2500)
(setq auto-save-timeout nil)

³o¼Ë¥i¥HÃö³¬¥H®É¶¡¬°°ò·Çªº¦Û°Ê¦sÀÉ¥\¯à¡A¥H§ï¥H¨C 2500 ¦¸Áä½Lªº°Ê§@ ®É¦Û°Ê¦sÀɤ@¦¸¡C·íµM¡A¦pªG§A¥¿¦n¦b¥´¤@«ó¤å¥ó®É¡A³Ì«áªº¨º­Ó°Ñ¼ÆÀ³¸Ó §â¥¦´î¤Ö¡A¦pªG¥¿¦b¼gµ{¦¡¨º»ò¥¦¤w¥iº¡¨¬»Ý¨D¤F¡C¦]¬°¨C¤@­Ó°Ê§@ (¤W¡B ¤U¡B¥ª¡B­Ë°h¡B¶K¡Aµ¥µ¥......) ³£¦C¤J­pºâ¡A 2500 ¦¸«öÁä½L·|«Ü§Ö´N¨ì ¹Fªº¡C''

4.9 ¦p¦ó§ä¥X§ó¦h³Ì¨Î¤Æªº¤èªk

¦pªG§Aªº Linux ¨t²Î¤´Â·|±`¥h¦s¨úµwºÐ¡A §A¥i¥H¨Ï¥Î ps ax ©R¥O ¨Ó¬Ý¬Ý¤º³¡¨ì©³¬O«ç»ò¤F¡C³o·|Åã¥Ü¥X©Ò¦³¥¿¦b°õ¦æªºµ{¦¡»P¥¦­Ìªº¦WºÙ¡A ¦³®É­Ô¥¦­Ì·|¨q¥X¨C­Ó³B²z¤¤ªºµ{¦¡¤§©R¥O¦C°Ñ¼Æ¡C

²{¦b½Ð¾\Ū¨C­Ó³B²z¤¤ªºµ{¦¡¤§ man ­¶¨Ó¤F¸Ñ¥¦­Ì¦b°µÔ£»ò¥H¤Î¦p¦ó §ïÅÜ¥¦ªº¦æ¬°¡C¥Î³o­Ó¤èªk¡A§A¦ü¥G¥i¥H§ä¨ì¤j³¡¥÷ªº³B²z¤¤µ{¦¡©Ò­t³dªº ¬O¤°»ò¡C§A¥i¯à·|µo²{ strace ¬O«Ü¦³À°§Uªº¡C

¦pªG§Aµo²{¦³­þ¨Ç·s¤èªk¡A½Ð§Aµo¹q¤l¶l¥óµ¹§Ú¡C


Next Previous Contents