[i=s] ±¾Ìû×îºóÓÉ okzokz123 ÓÚ 2011-5-13 16:37 ±à¼ [/i]
ÓÉÓÚ½üÀ´ÊÜÀÛÓÚdebian64ºÍubuntu64ÖеÄamuleÄÚ´æй©£¬ÊµÔÚÊǺܷ³£¬¾ÍÏëÁ˸ö°ì·¨À´ÁÙʱ½â¾öÕâ¸öÄÕÈ˵ÄÎÊÌ⣨×îÖÕ»¹ÊÇÒªdebϵÖÐamuleÆ·ÖʸÄÉƲÅÄܳ¹µ×½â¾ö£©¡£Õâ¸ö°ì·¨Ò²Í¨ÐÐÓÚÆäËûÓëÄÚ´æй©ÓйصÄÍøÂç³ÌÐò¡£
˼·£º
1.ͨ¹ý¶Ë¿ÚɨÃèÀ´È·¶¨ÄÚ´æÕ¼ÓôóµÄ½ø³Ì²¢½áÊø£¬Ä¿µÄÊǽáÊøÄÚ´æй©ʱµÄamule½ø³Ì£¨Õâ¸ö½Å±¾ÊÇÍøÉÏÕÒÀ´¸ÄµÄ·ÇÔ´´£¬ÏÈÉùÃ÷Ò»ÏÂÃâµÃ±»Ö¸³Ï®^_^£©
2.ʹÆä×Ô¶¯»¯
Ϊʲô²»½áÊøºóÔÙÖØÆôÄØÕâÀïÓм¸¸öÒò£ºµÚÒ»£¬ÄÚ´æй©ʱ´ÅÅÌi/oºÜ½ôÕŲ»È¥Ìí¼Ó¸ºµ£¡£µÚ¶þ£¬½áÊøºó¶Ìʱ¼äÄÚÖØÆô£¨´ÎÊý¶àµÄ»°£©¿Ö±»·þÎñÆ÷banµô¡£µÚÈý£¬ÍòһijÌìÎÒ²»·Å¿×Ó£¬µ«Â¿×Ó³öÀ´ÁËÆñ²»ÊÇ»¹ÒªÀ´½áÊøÕâ¸ö×Ô×÷¶àÇéµÄ½ø³Ìô(»¹µÃÑ»·½áÊø»òʹÓÃÁíÍâµÄ½Å±¾¾ÍÂé·³ÁË)¡£
´ïµ½µÚÒ»¸öÄ¿µÄºÜ¼òµ¥£¬Ê¹ÓÃÍøÉÏÕÒÀ´µÄ½Å±¾¸ÄϾÍokÁË£»Òª´ïµ½µÚ¶þ¸öÄ¿µÄÒ²ÈÝÒ×£¬Ê¹ÓÃlinuxÖеÄcrontab¾ÍÐУ¬µ«´øÀ´ÁíÍâÁ½¸öÎÊÌâ¹ØÓÚ´ÅÅ̱£»¤ºÍÓʼþ¡£
ºÃÁ˽øÈëÕýÌ⣺
1.½¨Á¢Ò»¸ö×Ô¼ºµÄtmpfsĿ¼ÓÃÀ´°²×°tmpfs£¬°Ñkill amuleµÄ½Å±¾·Å½øȥʹÆäÔÚ±£´æÔÚÄÚ´æÖУ¨Â¿×ÓµÄÄÚ´æй©ÊǺܿìµÄ£¬Ê®À´Ãë¾ÍÄÜÕ¼Êý°ÙM£¬ËùÒÔÎÒ½«°Ñ½Å±¾ÉèÖÃΪÿ10ÃëÔËÐÐÒ»´Î£¬ÎҲŲ»Ï£ÍûϵͳÔÚÓ²ÅÌÉÏÈç´ËƵ·±µÄ¶Á½Å±¾£©¡£µ±È»Ò²¿ÉÒÔʹÓÃϵͳ×Ô¼ºµÄ/dev/shm£¬Ö»²»¹ýÎÒϲ»¶×Ô¼ºµÄ¡£
$mkdir /home/yy/ktmp //ktmp¾ÍÊÇÓÃÀ´×°tmpfsµÄ yyÊÇÎÒµÄÓû§Ãû
2.ÈÃϵͳ¿ª»ú×Ô¶¯¹ÒÔØktmpΪtmpfs,Õâ¸öÒªÐÞ¸Ä/etc/fstabÁË
$sudo chmod +w /etc/fstab //¸øfstab¼ÓдÈëȨ
$sudo gedit /etc/fstab //ÐÞ¸Äfatab¼ÓÏÂÃæÕâÒ»ÐÐ
none /home/yy/ktmp tmpfs size=1888M,nodev,nosuid,noexec 0 0
ÕâÑù¿ª»ú×Ô¶¯¹ÒÔØktmp³Étmpfs²¢É趨×î´óÄÜʹÓÃ1888MB£¬²¢·Ç¾ÍÁ¢¿ÌÕ¼ÁËÕâô´óµÄÄڴ棬³ýÁ˽ű¾ÓõôµÄ¼¸°ÙK ÓàϵĻ¹¿É±»ÆäËû³ÌÐòÓá£
dfÄã»á·¢ÏÖ¶àÁ˸ö/home/yy/ktmpµÄ·ÖÇøÇÒÈÝÁ¿ÊÇ1888MB£¬µ«ÕâÊÇÄڴ棬¿É²»ÊÇÕæµÄ¶àÁË°¡£¬ÖØÒª¶«¶«²»Òª·ÅÀïÃæ¡£
3.×ö¸ökill amuleµÄ½Å±¾·ÅÔÚ /homt/yy/ÖÐÒÔ±ãÔØÈë/home/yy/ktmp£¬ÎÒÃüÃûΪkamule.ÄÚÈÝÈçÏ£º
#!/bin/bash
ram_max=10
//ÉèÖóÌÐòÄÜʹÓõÄ×î´óÄÚ´æ°Ù·Ö±ÈΪ10%´ïµ½Õâ¸öÖµ¼´´¥·¢killamule
port=4662;4672
//¼à¿Ø¶Ë¿Ú4662ºÍ4672 ÕâÊÇ¿×ÓÒªÓõÄ
pid_ram=` netstat -nlp |grep $port|awk '{print $7}'|awk -F / '{print $1}' `
//ͨ¹ý¶Ë¿Ú½Ø»ñ¿×ÓµÄpid
ram=` ps -aux |grep -m1 $pid_ram|awk '{print $4}'|awk -F . '{print $1}' `
//»ñµÃÄÚ´æÕ¼ÓÃÁ¿
if expr $ram \>= $ram_max > /dev/null
//Èç¹û·¢ÉúÒç³öµÄÌõ¼þÂú×ã¼´¿ªÊ¼ÏÂÃæµÄ²Ù×÷
then
echo "4662 amule be killed¡° >>/home/yy/autokamule.log //killʼþ·¢ÉúºóдÈëÈÕÖ¾
echo `date` >>/home/kk/autokamule.log //ÈÕÖ¾ÖÐ×·¼ÓÈÕÆÚ
kill -9 $pid_ram
//×Ô¶¯½áÊøÒç³öµÄµç¿½ø³Ì
mplayer /home/yy/ÒôÀÖ/°®µÄ¹©Ñø-ÑîÃÝ.mp3
//·ÅÊ׸èÒÔÌáʾ Ë˵ÓÃlinuxµÄ¾ÍûÓéÀÖÐèÇó£¿
fi //½áÊøÁË
4. ½¨Á¢/etc/cron.allow /etc/cron.deny ÕâÁ½¸öÎļþÄÚÊäÈëÓû§Ãû----ÿÐÐÒ»¸ö²»´ø¿Õ¸ñºÍ·ûºÅ£¨Õâ¸öÎÒÊÇÕÕÊéÉÏ×öµÄ£¬ÏÖÔڵİ汾ÊÇ·ñÐèÒª²»Çå³þ£¬ÕÕ×ö¾ÍÐÐÁË£©
5.$crontab -e //½¨Á¢×Ô¼ºµÄcrontabÎļþÈçÏÂ(±à¼Æ÷¿´×Ô¼ºÏ²ºÃ£¬ÓÃnanoÒ»»á¾Íѧ»áÁË)£º
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow command
#cp kamule to tmpfs
ÿÌìÔçÉÏ8£º10ÔØÈëkamuleµÄ½Å±¾µ½Ç°ÃæÉèÖõÄtmpfsÖÐ
10 8 * * * source ~/.bashrc && cp /home/yy/kamule /home/yy/ktmp
#sh kamule
É趨ÿʮÃëÔËÐÐÒ»´ÎkillamuleµÄ½Å±¾ ÕâÀïµÄ>>/dev/null 2>&1¸ü¸ÄÓʼþµØַΪ¿ÕʹÆä²»·¢µ½/var/spool/mail±ÜÃⱬ/var£¨Ã¿Ê®ÃëÒ»´ÎÌ«¶àÁË£©
* * * * * source ~/.bashrc sleep 10 && cd /home/yy/ktmp && bash kamule >>/dev/null 2>&1
* * * * * source ~/.bashrc sleep 20 && cd /home/yy/ktmp && bash kamule >>/dev/null 2>&1
* * * * * source ~/.bashrc sleep 30 && cd /home/yy/ktmp && bash kamule >>/dev/null 2>&1
* * * * * source ~/.bashrc sleep 40 && cd /home/yy/ktmp && bash kamule >>/dev/null 2>&1
* * * * * source ~/.bashrc sleep 50 && cd /home/yy/ktmp && bash kamule >>/dev/null 2>&1
##crontabдºÃºó°´±£´æ»á×Ô¶¯±£´æÔÚ/var/spool/cron/crontabsÖÐÒ»¸öÒÔÓû§ÃûΪÎļþÃûµÄÎļþÖУ¬Í¬Ê±Ò²»áдÈ뻺´æÆô¶¯
##Õâ¸ö#·ûºÅµÄÒ»ÐÐΪעÊÍ£¬ÀïÃæµÄºº×־Ͳ»ÒªÐ´½øÈ¥ÁË°üÀ¨±¾ÐС£
6.$sudo /etc/init.d/cron restart ËäÈ»ÏÖÔڵİ汾»á×Ô¶¯ÔËÐе«»¹ÊÇÖØÆôÒ»´Îcrontab·þÎñÀ´Á¢¿ÌÔËÐÐÒ»ÏÂÒÔÈ·¶¨ÉúЧ¡£
OK
ÕâÊǸöû°ì·¨µÄâÈÖ÷Ò⣬µ«ÖÁÉÙ·Å¿×ÓµÄʱºò²»ÅÂÒç³öÁË£¨ÌرðÊÇÈ˲»ÔÚµÄʱºòÒç³ö¹ÎÓ²ÅÌÄǸöÐÄÍ´°¡£©¡£Ï£ÍûdebainºÍubuntuÄܽâ¾ö¿×ÓÂÒÅܵÄÎÊÌâ¡£
ruanmeimofang ÓÚ 2014-05-26 17:09:10·¢±í:
Ö§³Ö»Ø¸´£¬Ö§³Ö¸ßÊÖ
gky2009514 ÓÚ 2012-12-07 13:24:47·¢±í:
ÐÂÊÖÍê³ÉÈÎÎñ£¬ÇóÏÂÊé¼®~
61344277 ÓÚ 2012-01-11 02:22:13·¢±í:
ËäÈ»ÍíÁ˼¸¸öÔ£¬²»¹ý»¹ÊÇ˵Éù°É
Â¥Ö÷µÄÎÊÌ⣬Óà ulimit ½â¾ö±È½ÏºÃ
wq413732076 ÓÚ 2011-08-03 21:12:02·¢±í:
¸Ðл¥Ö÷·ÖÏíÎÒҪѧlinux
dqwit ÓÚ 2011-05-30 17:48:38·¢±í:
¹þ¹þ¹þ
346467156 ÓÚ 2011-05-14 00:55:49·¢±í:
»¹²»´í¡£Ö§³ÖÔ´´~~
346467156 ÓÚ 2011-05-14 00:55:48·¢±í:
»¹²»´í¡£Ö§³ÖÔ´´~~
GrowthÕ× ÓÚ 2011-05-13 09:48:45·¢±í:
¸Ðлokzokz123µÄ·ÖÏí£¬±¾Ìù¼ÓÈëµ½ÂÛ̳¶¥ÖõÄLinuxÓ¦ÓÃÌùÖÐ
qvooqi ÓÚ 2011-05-12 21:11:58·¢±í:
Ç¿ÎÄ£¬Ö§³ÖÂ¥Ö÷