운영 스크립트를 처음 개발하게 되면 절대 위치를 근거로 스크립트를 만들게 된다.


#!/bin/sh

#!/bin/bash

#!/usr/local/python


처음에는 잘 쓰다가 python이나 ruby를 만나게 되면 당연하게 절대위치를 가르키게 한다.

이때 문제가 절대위치를 쓰게 되면 운영 스크립트는 설치자에 dependent가 생길 수 밖에 없다.

예를 들어 /usr/local/python 에 python을 설치하면, 거기에 맞추게 된다. 그러나. yum이나 apt-get 과 같은 툴로 설치했다면 위치는 달라지게 된다. 

결국 운영 스크립트는 설치 소프트웨어, 스크립트 환경과 달리 다르게 구성해야 한다.


리눅스계열과 맥의 OS X에서는 env utility(/usr/bin/env)가 있다. PATH를 뒤져주는 녀석이라 할 수 있다. 

이런 역할을 하는 것을 고급용어로 shebang이라고 한다. 

자세한 것은 env man 페이지를 참고한다. 


이를 이용해서 설치와는 다르게 진행하는게 운영관점에서 상당히 좋은 듯 하다.


#!/usr/bin/env sh

#!/usr/bin/env bash

#!/usr/bin/env python


'unix and linux' 카테고리의 다른 글

nagios 스크립트 실행 코드  (0) 2013.10.02
nagios ncsa 연동  (0) 2013.10.02
리눅스 커널 3.0.0-rc1 commit  (0) 2011.05.31
netstat를 완전 믿지 말자.  (0) 2010.08.18
wget spider 옵션  (0) 2010.08.04
Posted by '김용환'
,


토발스 아저씨가. 리눅스 2.6에서 리눅스 3.0.0-rc1으로 commit했습니다. 


<코드 커밋 내용>

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=55922c9d1b84b89cb946c777fddccb3247e7df2c


 .. except there are various scripts that really know that there are

three numbers, so it calls itself "3.0.0-rc1".

Hopefully by the time the final 3.0 is out, we'll have that extra zero
all figured out.




<토발스 아저씨 메일>

메일에 따르면, 바뀌는 부분은 사소한 것 같습니다. 
20주년 기념으로 새롭게 renumbering 으로 간다고 생각하시면 될 것 같습니다. 

 So what are the big changes?

NOTHING. Absolutely nothing. Sure, we have the usual two thirds driver
changes, and a lot of random fixes, but the point is that 3.0 is
*just* about renumbering, we are very much *not* doing a KDE-4 or a
Gnome-3 here. No breakage, no special scary new features, nothing at
all like that. We've been doing time-based releases for many years
now, this is in no way about features. If you want an excuse for the
renumbering, you really should look at the time-based one ("20 years")
instead.


<관련 기사>


'unix and linux' 카테고리의 다른 글

nagios ncsa 연동  (0) 2013.10.02
운영 스크립트 - #!/bin/sh 과 #!/usr/bin/env bash  (0) 2013.07.01
netstat를 완전 믿지 말자.  (0) 2010.08.18
wget spider 옵션  (0) 2010.08.04
프로세스별 cpu ration 구하기  (0) 2010.07.13
Posted by '김용환'
,

netstat -anp로 종종 socket 연결 상태를 확인하는데..
중간에 1,2개정도 socket을 빠뜨리기도 한다. 흘... 놀랬잖아~

CENT os 5.3 사용중..
Posted by '김용환'
,


wget --spider http://www.naver.com
--14:23:14--  http://www.naver.com/
           => `index.html'
Resolving www.naver.com... 222.122.195.6, 202.131.29.70
Connecting to www.naver.com|222.122.195.6|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
200 OK

header정보만 받아서 보여주는 기능이 spider 임.

http://linux.die.net/man/1/wget
--spider
When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there. For example, you can use Wget to check your bookmarks:
wget --spider --force-html -i bookmarks.html
This feature needs much more work for Wget to get close to the functionality of real web spiders.

'unix and linux' 카테고리의 다른 글

리눅스 커널 3.0.0-rc1 commit  (0) 2011.05.31
netstat를 완전 믿지 말자.  (0) 2010.08.18
프로세스별 cpu ration 구하기  (0) 2010.07.13
NAS 대 NAS 복사하기 (mount 이용)  (0) 2010.06.10
파일 하나만 Rsync하기  (0) 2009.10.08
Posted by '김용환'
,



How do I Find Out Linux CPU Utilization?
http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html

man ps
http://unixhelp.ed.ac.uk/CGI/man-cgi?ps

리눅스 프로세스별 cpu 조사
http://www.joinc.co.kr/modules/moniwiki/wiki.php/Code/JPerl/Process_Status

결과
./test1.sh xxx
Process Status OK |status=1 cpu=21.20 mem=34.20 num=21 size=7576504 thread=1234

Assessing CPU Utilization 고찰
http://students.cs.unipi.gr/pub/docs/sysadmin-1992-1998/html/v07/i05/a7.htm



나름대로의 결과..

cpu utiltization을 사용하고 있음.. 앞으로 잘 사용할 수 있을 것 같아..

#!/bin/sh

PID=$1
WAIT_TIME=$2

if [ -z $1 ] || [ -z $2 ]; then
    echo "You must specify process ID or Waiting time"
    echo "ex) shell-command.sh httpd 10"
    echo "ex) shell-command.sh process-id 10"
    exit
fi


if [ $PID == "httpd" ]; then
    PID=`ps -ef | grep 'httpd' | grep 'root' | awk '{print $2}'`
    echo "apache httpd pid(root) : $PID"
fi


CPUNUM_STR=`grep -c 'core id' /proc/cpuinfo`;
CPUNUM=`expr $CPUNUM_STR`

echo "cpu number : $CPUNUM";
echo "wait time  : $WAIT_TIME";

while [ true ]; do
   echo -n `date +"%Y/%m/%d %H:%M:%S"`
   printf '\t'
   ps -eo pid,ppid,pcpu | grep $PID | awk -v CPU_NUM=$CPUNUM ' { SUM += $3 } END { print SUM/CPU_NUM}'
   sleep $WAIT_TIME
done

'unix and linux' 카테고리의 다른 글

netstat를 완전 믿지 말자.  (0) 2010.08.18
wget spider 옵션  (0) 2010.08.04
NAS 대 NAS 복사하기 (mount 이용)  (0) 2010.06.10
파일 하나만 Rsync하기  (0) 2009.10.08
SMTP 서버 테스트  (0) 2009.08.14
Posted by '김용환'
,


1) mount 사용

 /bin/mount -t nfs -o nfsvers=3,rsize=32768,wsize=32768  1.1.1.1:/vol/content  /media/content

2) 복사

3) unmount 



           nfsvers             원격 호스트의 NFS 데몬과 접속하기 위해 사용
                                하는 별도의 RPC 버전 번호를정한다. NFS 서버
                                를 여러 개 운영하고 있을 때 사용한다. 기 본
                                값은 버전 2 이다.



자세한 내용은 아래 참조

http://unix.co.kr/bbs/board.php?bo_table=03_4&wr_id=750

http://webcache.googleusercontent.com/search?q=cache:JKlPco2oVi8J:syszone.co.kr/bbs/zboard.php%3Fid%3Dlinux%26page%3D2%26sn1%3D%26divpage%3D1%26category%3D1%26sn%3Doff%26ss%3Don%26sc%3Don%26select_arrange%3Dheadnum%26desc%3Dasc%26no%3D636+mount+명령어+nfsvers&cd=1&hl=ko&ct=clnk&gl=kr

'unix and linux' 카테고리의 다른 글

wget spider 옵션  (0) 2010.08.04
프로세스별 cpu ration 구하기  (0) 2010.07.13
파일 하나만 Rsync하기  (0) 2009.10.08
SMTP 서버 테스트  (0) 2009.08.14
리눅스에서 이클립스 설정 파일 커밋하기  (0) 2009.08.07
Posted by '김용환'
,


디렉토리가 아닌 파일하나만 rsync하고 싶을 때 사용.
rsync -av  www_ddos.txt  gooapp303::xxx

Rsync를 잘 설명해놓은 글.
http://blog.pages.kr/50

Posted by '김용환'
,

[xxx /usr/local/james/conf]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 xxx SMTP Server (JAMES SMTP Server 2.3.1) ready Thu, 13 Aug 2009 19:11:33 +0900 (KST)
helo google.com
250 smpapp301 Hello google.com (localhost.localdomain [127.0.0.1])
mail from:<knight@google.com>
250 2.1.0 Sender <knight@google.com> OK
rcpt to:<knight@google.com>
250 2.1.5 Recipient <knight@google.com> OK
DATA
354 Ok Send data ending with <CRLF>.<CRLF>
afasdfsaf
asfd
.
250 2.6.0 Message received

Posted by '김용환'
,

sed를 이용하여 특정 파일(.classpath) 수정하고 커밋하기
sed 사용할 때 enter는 '\n' 로 사용하면 된다. 특수문자는 그대로 쓰면 되고, / 만 유의하면 됨.

 find . -maxdepth 1 -name '.classpath' -print  | xargs sed -i 's/<classpath>/<classpath>\n    <classpathentry excluding="sql-map*.properties" kind="src"  path="src\/conf"\/> /g' ;
svn commit -m 'DEVSUS-208' --username knight76

'unix and linux' 카테고리의 다른 글

파일 하나만 Rsync하기  (0) 2009.10.08
SMTP 서버 테스트  (0) 2009.08.14
How to get the biggest filesystem In all filesystem  (0) 2009.06.09
bash와 csh의 차이점  (0) 2009.03.24
시스템 정보 받아오기 #2  (0) 2009.03.24
Posted by '김용환'
,

bigsize=`df | grep '/'  | awk '{print $1}' | sort | head -1`

'unix and linux' 카테고리의 다른 글

SMTP 서버 테스트  (0) 2009.08.14
리눅스에서 이클립스 설정 파일 커밋하기  (0) 2009.08.07
bash와 csh의 차이점  (0) 2009.03.24
시스템 정보 받아오기 #2  (0) 2009.03.24
시스템 정보 가지고 오기 #1  (0) 2009.03.24
Posted by '김용환'
,