Unix/Solaris °ü·Ã°Ô½ÃÆÇ

2000/12/06(21:34) from 203.254.154.69
ÀÛ¼ºÀÚ : °­ÁÙ±â (jkkang65@hanmail.net) Á¶È¸¼ö : 2563 , ÁÙ¼ö : 308
Re: ÀëÀÖ´Â ¼Ö¶ó¸®½º À̾߱â - µÎ¹ø°
¾Æ·¡ ±Û¿¡ À̾ ^^

ÀëÀÖ´Â ¼Ö¶ó¸®½º À̾߱⠿­Çѹø° À̾߱â

           µð½ºÅ© ¿ë·®ÀÌ ¾øÀ»¶§ À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ´Â NFS¸¦ ¼Ò°³ÇÕ´Ï´Ù.

           Solaris 2.x¿¡¼­ server/client setup manual

           NFS server

           1./etc/dfs/dfstab file ¼öÁ¤

           share -F nfs /home === /homeÀº °øÀ¯ÇÏ°íÀÚÇÏ´Â µð·ºÅ丮

           run-level 3¿¡¼­ ½ÇÇà°¡´ÉÇÔ

           2.NFS daemon ÀÌ ½Ãµ¿

           # /etc/init.d/nfs.server start

           3. #shareall

           4. ÀÚ¿øÀÌ È°¿ë°¡´ÉÇÑÁö dfshares ¸í·É¾î·Î È®ÀÎ

           # dfshares

           RESOURCE SERVER ACESS TRANSPORT

           hostname:/home hostname - -

           À§¿Í °°ÀÌ µÇ¸é »ç¿ë°¡´ÉÇÔ

           ---- dfshares·Î È®ÀεÇÁö ¾ÊÀ¸¸é #reboot -- -rÇÏ¿© checkÇÔ

           NFS client

           1. /etc/vfstab¿¡ µî·Ï

           server hostname:/home - /home1 nfs - yes -

           ¼­¹öÀ̸§:°øÀ¯ÀÚ¿ø µð·ºÅ丮 - client µð·ºÅ丮 fstype

           2 #reboot -- -r·Î bootÈÄ #df·Î mount È®ÀÎÇÑ´Ù.

¹«´õ¿î ¿©¸§À» °­Å¸ÇÒ CronÀ» ¼Ò°³ÇÕ´Ï´Ù.

           ¸Ô´Â Å©¸²À̳ª °¡¼ö Ŭ·ÐÇÏ°í´Â ´Ù¸£Áö¸¸ ½Ã½ºÅÛÀ» ¿î¿µÇϸ鼭

           CronÀ» ¸ð¸¥´Ù¸é ¸»ÀÌ ¾ÈµÇÁÒ. Âü°íÇÏ½Ã¸é ¾÷¹«°¡ ÆíÇØÁý´Ï´Ù.

           1. °³ ¿ä

           ÁöÁ¤µÈ ½Ã°£(time)¿¡ ¿¬¼ÓÀûÀ¸·Î ½ÇÇàÇÏ´Â Unix Background programÀ̳ª daemonÀ»

           cronÀ̶ó ÇÏ°í,

           Á¤±âÀûÀ¸·Î Á¤ÇØÁø ½Ã°£¿¡ ½ÇÇà µÉ ÀÛ¾÷À» ÁöÁ¤ÇÏ´Â utility·Î´Â crontabÀ̳ª atµîÀÌ
           ÀÖ´Ù.

           Áï, cronÀº ÀÏÁ¤ÇÑ ½Ã°£¿¡ ±× ÀÛ¾÷À» ½ÇÇàÇÏ´Â clock daemonÀÌ°í crontabÀº ±× ÀÛ¾÷À»

           ÁöÁ¤ÇÑ´Ù.

           1) crontab : ÁÖ±âÀûÀ¸·Î ½ÇÇàµÇ´Â ÀÛ¾÷µéÀ» ³ªÅ¸³»´Â ½ºÄÉÁ층À» ÀÛ¼º

           2) at : ÁöÁ¤µÈ ½Ã°£¿¡ ¼öÇàµÇ´Â ÀÛ¾÷À» ½ºÄÉÁì

           ´Ù¸£°Ô Ç¥ÇöÇϸé, ÀÚµ¿À¸·Î ÀÛ¾÷ °úÁ¤À» ¼öÇà, crontabÀº Á¤±âÀûÀ¸·Î Á¤ÇØÁø

           ½Ã°£¿¡ ½ÇÇàµÉ ÀÛ¾÷À» ÁöÁ¤ÇÏ´Â À¯Æ¿¸®Æ® ¶Ç´Â µÇÇ®ÀÌ µÇ´Â JobsÀÇ

           schedulingµîÀ¸·Î ÀÌÇØ ÇÏ¸é µÇ°Ú´Ù.

           2. ¼Ò °³

           »ç¿ëÀÚ´Â crontab commandÀÇ »ç¿ë¿¡ ÀÇÇØ ÀÏ, ÁÖ, ¿ù º°·Î system admin commandÀÇ

           ÀÛ¾÷À»

           ½ºÄÉÁì ÇÒ¼ö ÀÖ´Ù. ¿¹¸¦ µé¸é

           Daily

           1) temporary directory·Î ºÎÅÍ ¾à°£ ½ÃÀÏÀÌ Áö³­ junk fileµéÀÇ »èÁ¦

           2) Executing accounting summary commands

           3) df ³ª ps command¸¦ »ç¿ëÇÏ¿© systemÀÇ snapshots ÀÛ¾÷

           4) security monitoring

           5) system backups

           Weekly

           1) man -k¿¡ ÀÌ¿ëµÇ´Â catman databaseÀÇ À籸¼º

           2) fsck -yÀ» ¼öÇàÇؼ­ ¾î¶°ÇÑ(any) disk ¹®Á¦ÀÇ list¸¦ ¸¸µç´Ù.

           Monthly

           1) ¸Å¿ù »ç¿ëÇÏÁö ¾Ê´Â fileÀÇ list¸¦ ÀÛ¼º

           2) Monthly accounting º¸°í¼­ÀÇ »ê¼ú

           Ãß°¡ÀûÀ¸·Î user´Â system ÀÛ¾÷ °úÁ¤À» ´Ù¸£°Ô ¼öÇàÇϱâ À§ÇÏ¿©

           crontab command¸¦ scheduleÇÒ ¼ö ÀÖ°í, ÀÌ·¯ÇÑ ÀÛ¾÷µéÀ» backup

           file·Î¼­ ¸¸µé¾î ³õÀ» ¼ö ÀÖ´Ù.

           3. How the cron Daemon Handle scheduling?

           cron daemonÀº crontab commandsÀÇ scheduleÀ» ÀÚµ¿À¸·Î handle ÇÑ´Ù.

           ÀÌ ±â´ÉÀº crontab fileÀÇ Á¸Àç¿©ºÎ¿¡ ´ëÇÏ¿© /usr/spool/cron/crontab

           ( or /var/spool/cron/crontab ) directory¸¦ ¸Å 15ºÐ¸¶´Ù check

           ÇÏ¹Ç·Î½á ¼öÇàµÈ´Ù. ÀÌ¿Í °°ÀÌ cron daemonÀº checkÇؼ­ »õ·Î¿î crontab

           fileÀÌ Àְųª º¯È­°¡ ÀÖ´Â °ÍÀÌ ÀÖ´Ù¸é file¾È¿¡ ÀÖ´Â ½ÇÇàÇÒ ½Ã°£

           listÀ» Àо Àû´çÇÑ ½Ã°£¿¡ ¸ÂÃß¾î ¼öÇàÇÒ ¸í·ÉµéÀ» ½ÇÇàÇÑ´Ù.

           °°Àº ¹æ½ÄÀ¸·Î cron daemonÀº at fileÀ» scheduling controlÇÏ°í,

           /var/spool/cron/atjobs directory¿¡ ÀúÀåÇÑ´Ù.

           4. cronÀÇ ºÎ¿¬ ¼³¸í

           NAME cron - clock daemon

           SYNOPSIS /usr/sbin/cron

           AVAILABILITY SUNWcsr

           DESCRIPTION cron command´Â ƯÁ¤ÇÑ ³¯Â¥¿Í ½Ã°£ÀÌ µÇ¸é ¸í·É¾îµéÀ» ¼öÇàÇÏ´Â

           process¸¦ ½ÃÀÛÇÑ´Ù.

           ½ÇÁ¦ÀûÀ¸·Î command´Â /var/spool/cron/crontab directory¿¡ ÀÖ´Â

           crontab fileÀÇ ¸í·É¾îµé¿¡ µû¶ó¼­ ½ºÄÉÁì µÈ´Ù.

           userµéÀº crontab command¸¦ »ç¿ëÇÏ¿© ÀڽŸ¸ÀÇ crontab fileÀ»

           ¼öÇà ÇÒ ¼ö ÀÖ´Ù.

           cronÀº ¿ÀÁ÷ crontab or at command·Î¼­ crontab fileÀ̳ª at °ü·Ã

           fileÀÌ change µÉ ¶§ °Ë»çÇÏ¿© initializationÀ» ÁøÇàÇÑ´Ù.

           cronÀº ½º½º·Î °áÄÚ ³¡³ªÁö ¾Ê´Â´Ù.

           /etc/rc2.d/S75cron¿¡ ÀÇÇØ system booting½Ã µü ÇÑ ¹ø ¼öÇàµÇ°í,

           system down½Ã ³¡³ª°Ô µÈ´Ù.

           /etc/cron.d/FIFO fileÀº Çϳª ÀÌ»óÀÇ cronÀÌ ¼öÇàÇÏ´Â °ÍÀ» ¸·´Â

           ÀÏÁ¾ÀÇ lock fileÀÌ´Ù.

           cron¿¡ ÀÇÇØ ¸ðµç actionÀÇ log¸¦ °è¼Ó ÁøÇàÇÏ·Á¸é /etc/default/cron

           fileÀÇ ³»¿ë Áß¿¡¼­ ¡®CRONLOG= YES¡¯ ·Î ÇØ ³õÀ¸¸é µÈ´Ù.

           NO·Î µÇ¾î ÀÖÀ¸¸é loggingÀÌ ³¡³­´Ù.

1ź¿¡ À̾î 2źÀÌ À̾îÁý´Ï´Ù.

           5. Inside a crontab file

           cron daemonÀº °¢ crontab file¾È¿¡¼­ ¹ß°ßµÇ´Â commands¿¡ µû¶ó¼­ system event°¡

           scheduleµÈ´Ù. crontab fileÀº ¸í·É¾îµé·Î ±¸¼ºµÇ´Âµ¥ °¢ lineÀº ±ÔÄ¢ÀûÀÎ °£°ÝÀ¸·Î

           ¼öÇàµÈ´Ù.°¢ line¿¡ Æ÷ÇԵǾî ÀÖ´Â date¿Í timeÀÇ Á¤º¸´Â ±× command°¡ ¼öÇàµÉ ¶§

           cron daemon¿¡°Ô Àü´ÞµÈ´Ù.

           EX]

           0 20 * * 0,4 /etc/cron.d/logchecker

           5 4 * * 6 /usr/lib/newsyslog

           15 3 * * * /usr/lib/fs/nfs/nfsfind

           Ã¹¹ø° line : ÀÏ¿äÀÏ, ¸ñ¿äÀÏ ¿ÀÈÄ 8½Ã¿¡ logchecker¸¦ ¼öÇàÇϵµ·Ï system¿¡ Áö½Ã

           µÎ¹ø° line : ¸Å Åä¿äÀÏ ¾Æħ 4:05ºÐ¿¡ newsyslog¸¦ ¼öÇàÇϵµ·Ï systemdÀ» schedule

           ¼¼¹ø° line : ¸ÅÀÏ 3:15 a.m¿¡ nfsfind°¡ ¼öÇàÇϱâ À§ÇÏ¿© system¿¡ order

           OS¿¡ Àû¿ëµÇ´Â ±âº»

           crontab files Function

           adm Accounting

           lp Printing

           root General system function and file system cleanup

           sys Performance collection

           ´Ù¸¥ crontab file nameÀº user account·Î¼­ »ý¼ºÇÒ ¼ö ÀÖ´Ù.

           Default crontab fileÀÌ¿Ü¿¡µµ user´Â system event scheduleÀ» ÇÒ ¼ö ÀÖ´Â

           crontab fileÀ» »ý¼º °¡´É

           *crontab fileÀÇ Time field

           M H D m d command

           M(Minute) : ºÐ 0 ~ 59

           H(Hour) : ½Ã 0 ~ 59

           D(Day) : ÀÏ 1 ~ 31

           m(month) : ¿ù 1 ~ 12

           d(weekday) : ÁÖ¸» ³¯Â¥ 0 ~ 6 ( 0:ÀÏ, 1:¿ù, 2:È­, 3:¼ö, 4:¸ñ, 5:±Ý, 6:Åä )

           command : ¼öÇàÀÌ µÇ´Â command

           a. °¢ fieldÀÇ ±¸ºÐÀº space

           b. ,(comma)·Î¼­ ¿©·¯°³ÀÇ °ª(multi value)À» ±¸ºÐ

           c. -(hypen)·Î¼­ °ªÀÇ ¹üÀ§¸¦ ÁöÁ¤

           d. *(wildcard)·Î¼­ ¸ðµç »ç¿ë °¡´ÉÇÑ °ªÀ» Æ÷ÇÔ

           e. #(comment mark)Àº ±× lineÀÇ ½ÃÀÛ¿¡ À־ comment or blank lineÀ» ÀǹÌ

           EX]

           0 16 1,15 * * echo Nice to meet you! > /dev/console

           -¸Å¿ù 1,15Àϸ¶´Ù ¿ÀÈÄ 4½Ã°¡ µÇ¸é consolewindow¿¡

           Nice to meet you!¶ó´Â messageÃâ·Â

2ź¿¡ À̾î 3źÀ»

           *crontab fileÀÇ display

           # crontab -l [username]

           ; ÇØ´ç user·Î µî·ÏµÇ¾î ÀÖ´Â crontab list¸¦ display

           # croltab -l jones

           1 0 * * 6 rm /home/jones/*.log > /dev/null 2>&1

           # crontab -l

           9) crontab fileÀÇ remove

           # crontab -r [username]

           ; ÇØ´ç user·Î ¼³Á¤µÇ¾î ÀÖ´Â crontabÀ» remove

           7. command¿Í °ü·Ã file

           command What if schedules Location of files Files that control access

           crontab Repetitive system events /usr/spool/cron/crontabs /etc/cron.d/cron.allow

           or /usr/spool/cron/crontabs /etc/cron.d/cron.deny

           1) /etc/cron.d/cron.allow : crontabÀ» »ç¿ë °¡´ÉÇÑ user¸¦ µî·Ï

           /etc/cron.d/cron.deny : crontab »ç¿ë ºÎ°¡ÇÑ user¸¦ µî·Ï

           2) user°¡ crontabÀ» accessÇÏ·Á°í ÇÒ ¶§, ±× user°¡ Á¸Á¦ÇÑ´Ù¸é cron.allow fileÀ»
           ¸ÕÀú ÀÐ°í »ç¿ë

           ¿©ºÎ¸¦ µûÁø´Ù. Áï, crontab commandÀÇ ÀÛ¾÷À» Á¦ÇÑÇÏ·Á´Â ¸ñÀûÀ» °¡Áö°í ÀÖ´Ù.

           a. ¸¸¾à cron.allow fileÀÌ Á¸ÀçÇÑ´Ù¸é ¿ÀÁ÷ ÀÎÁ¤µÈ userµé¸¸ÀÌ crontab fileÀ» »ý¼º,
           ÆíÁý, Ãâ·Â,

           »èÁ¦ ÇÒ ¼ö ÀÖ´Ù.

           b. ¸¸¾à cron.allow file Á¸ÀçÇÏÁö ¾ÊÀ¸¸é ¸ðµç user°¡ crontab commandÀ» ¼öÇà °¡´É.

           ´Ü, cron.deny file¾È¿¡ Á¸ÀçÇÏ´Â userµéÀº Á¦¿ÜµÈ´Ù.

           c. cron.deny°¡ ºñ¾î ÀÖ°í, cron.allow°¡ Á¸ÀçÇÏÁö ¾ÊÀ¸¸é ¸ðµç »ç¿ëÀÚµéÀÌ crontab
           »ç¿ë

           d. µÎ fileÀÌ Á¸ÀçÇÏÁö ¾ÊÀ¸¸é root( superuser )¸¸ÀÌ crontab access

           e. default·Î cron.allow fileÀº O/S install½Ã »ý¼ºµÇÁö ¾Ê°í, cron.deny fileÀº
           »ý¼ºµÇ´Âµ¥

           ±× ³»¿ëÀº daemon, bin, smtp, nuucp, listen, nobody, noaccess ÀÌ´Ù.

           # cat /etc/cron.d/cron.deny

           EX] hana, gangsan À̶ó´Â user¸¦ Á¦ÇÑÇϱâ À§Çؼ­´Â /etc/cron.d/cron.deny file¿¡ µÎ
           userÀÇ list¸¦ Ãß°¡ÇÑ´Ù

Modify Delete Post Reply Backward Forward List
Powered by Kang Jul Ki