반응형
외부 ip들의 공격을 방어하기 위해 자동으로 ban list를 만들어주는 fail2ban을 설치해 보겠다.
아래 내용들은 메뉴얼 페이지를 기반으로 정리한 것이다.
 

1. 요구사항

공식 홈페이지에 따르면 0.8 버젼 이상에서는 Python 2.4 버전 이상을 요구하고 있다.
하지만 2.4버전은 SYSLOG 소켓에 문제가 있어, SYSLOG를 사용하고 싶으면 2.5버젼 이상을 권장한다.

2. 설치

apt-get, aptitude를 사용하여 설치한다.

aptitude install fail2ban


3. 정의

filter: log-in fail과 관련된 정규표현식
action: 행동한 command들
jail: filter와 action의 조합, jail2ban은 여러 조합을 동시에 처리한다.


4. 설정

fail2ban-server와 fail2ban-client로 구성되며 server는 socket을 감시하는 역할을 하고
client는 세팅 및 소통을 하는 역할로 보면 될 것 같다.

기본 설정파일은 /etc/fail2ban에 존재하며
변경은 fail2ban-client -c <DIR> 을 통해 변경 가능하다.

fail2ban.conf  - Logging level, client/server socket 등과 같은 전체 세팅을 하는 파일이다.
                      일단 우리에게 중요하지 않아 신경을 쓰지 않는다.

jail.conf - 가장 중요한 파일이다. 아래에서 자세한 세팅 예시를 살펴보자
[ssh-iptables]  // Section 이름
#enabled  = false
enabled  = true // Section Enable 여부
filter   = sshd // Filter로 Filter.d/sshd.conf 파일을  사용한다
action   = iptables[name=SSH, port=ssh, protocol=tcp] // filter가 true일 경우 action.d/iptables.conf 를 action으로 사용한다.
#          mail-whois[name=SSH, dest=yourmail@mail.com]
#logpath  = /var/log/sshd.log
logpath  = /var/log/auth.log  // Filter가 감시할 Log파일의 위치를 표시해 준다.
maxretry = 5 //Action을 하게 만드는 Match의 회수 ex)5번 filter에 걸리면 action 실행
findtime = 600 // (단위 sec) 해당 시간 동안 fail이 없으면 Counter(maxretry관련)를 초기화 한다. 
bantime = 600 // (단위 sec) 해당 시간 동안 IP를 BAN한다 값이 마이너스이면 영원히 BAN한다.
Section당 Filter는 한개만 가능하지만 Action는 여러개 등록이 가능하며 순차적으로 실행된다.

filter.d/*.conf - 필터에 관련된 regex 파일이다. Python Base Regex으로 작성하면 된다.
failregex = Authentication failure for .* from <HOST>
            Failed [-/\w]+ for .* from <HOST>
            ROOT LOGIN REFUSED .* FROM <HOST>
            [iI](?:llegal|nvalid) user .* from <HOST>
Multline으로 작성이 가능하며 한 라인 한 라인이 Regex이다.
매줄에는 IP에 해당하는 <HOST> 가 반드시 존재해야 하고 아니면 오류를 보여준다.
<HOST>는 IPv4에 해당하는 alias이다. = (?:::f{4,6}:)?(?P<host>\S+)

직접 작성한 conf를 테스트 하고 싶으면 아래와 같은 명령을 통해 테스트 할 수 있을 것이다.
fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/test.conf
action.d/*.conf - Action과 관련된 Command 명령어이다


5. 나의 MBL 설정

현재 나는 MBL을 Torrent 머신으로 사용중이다. 주로 용도는 ssh, ftp, samba등을 통한 접속 이 될것이다.
MBL에서는 커널상의 문제로 iptable을 사용하지 않기 때문에 직접 /etc/hosts.deny에 deny 리스트로 ip를 추가하는 방법을 사용하였다. 전체 접근 제한은 3번이고 ftp와 apach도 추가하여 주었다.

[DEFAULT]
ignoreip = 127.0.0.1/8 findtime = 600
bantime = -1
maxretry = 3
backend = auto
action = hostsdeny[]
protocol = tcp

[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/sshd.log

[ssh-ddos]
enabled = true
port = ssh
filter = sshd-ddos
logpath = /var/log/sshd.log

[apache]
enabled = true
port = http,https
filter = apache-auth
logpath = /var/log/apache*/*error.log

[vsftpd]
enabled = true
port = ftp,ftp-data,ftps,ftps-data
filter = vsftpd
logpath = /var/log/vsftpd.log


반응형
반응형

이번 글은 MBL에 Torrent Client인 Transmission을 설치하고 사용해 보겠다

참고자료: http://mybookworld.wikidot.com/transmission



1. 9091 포트를 포트 포워딩 해준다.


공유기 설정에서 9091포트를 MBL로 포트 포워딩 해준다.

해당 포트는 외부 접속관리 프로그램인 Transmission GUI의 접근을 위한 포트가 될 것이다.



2. Tansmission 설치


MyBookLive:~# ipkg update

MyBookLive:~# ipkg install transmission



설치 완료입니다!!


데몬 실행은 /opt/bin/transmission-daemon

종료는 killall transmission-daemon  입니다



transmission의 remote access및 watch를 위해서 다음과 같은 설정 파일을 변경해야됩니다.


vi등의 에디터로 

/root/.config/transmission-daemon/settings.json

파일을 열어 다음과 같이 수정한다



{

    "alt-speed-down": 50, 

    "alt-speed-enabled": false, 

    "alt-speed-time-begin": 540, 

    "alt-speed-time-day": 127, 

    "alt-speed-time-enabled": false, 

    "alt-speed-time-end": 1020, 

    "alt-speed-up": 50, 

    "bind-address-ipv4": "0.0.0.0", 

    "bind-address-ipv6": "::", 

    "blocklist-enabled": true, 

    "blocklist-url": "http://www.bluetack.co.uk/config/level1.gz", 

    "cache-size-mb": 4, 

    "dht-enabled": true, 

    "download-dir": "/DataVolume/shares/Public/TR-Downloads", 

    "download-queue-enabled": true, 

    "download-queue-size": 5, 

    "encryption": 1, 

    "idle-seeding-limit": 30, 

    "idle-seeding-limit-enabled": false, 

    "incomplete-dir": "/DataVolume/shares/Public/TR-INCOMPLETE", 

    "incomplete-dir-enabled": true, 

    "lpd-enabled": false, 

    "message-level": 2, 

    "peer-congestion-algorithm": "", 

    "peer-limit-global": 240, 

    "peer-limit-per-torrent": 60, 

    "peer-port": 51413, 

    "peer-port-random-high": 65535, 

    "peer-port-random-low": 49152, 

    "peer-port-random-on-start": false, 

    "peer-socket-tos": "default", 

    "pex-enabled": true, 

    "port-forwarding-enabled": false, 

    "preallocation": 1, 

    "prefetch-enabled": 1, 

    "queue-stalled-enabled": true, 

    "queue-stalled-minutes": 30, 

    "ratio-limit": 2, 

    "ratio-limit-enabled": false, 

    "rename-partial-files": true, 

    "rpc-authentication-required": true, 

    "rpc-bind-address": "0.0.0.0", 

    "rpc-enabled": true, 

    "rpc-password": "pwd", 

    "rpc-port": 9091, 

    "rpc-url": "/transmission/", 

    "rpc-username": "id", 

    "rpc-whitelist": "127.0.0.1", 

    "rpc-whitelist-enabled": false, 

    "scrape-paused-torrents-enabled": true, 

    "script-torrent-done-enabled": false, 

    "script-torrent-done-filename": "", 

    "seed-queue-enabled": false, 

    "seed-queue-size": 10, 

    "speed-limit-down": 100, 

    "speed-limit-down-enabled": false, 

    "speed-limit-up": 100, 

    "speed-limit-up-enabled": false, 

    "start-added-torrents": true, 

    "trash-original-torrent-files": false, 

    "umask": 0, 

    "upload-slots-per-torrent": 14, 

    "utp-enabled": true,

   "watch-dir": "/shares/Public/TR-watch", 
   "watch-dir-enabled": true

} 


MyBookLive:~# chmod 600 /root/.config/transmission-daemon/settings.json

이제 

/etc/init.d/transmission-daemon


파일을 만들고 아래 내용을 채워 넣는다


#! /bin/sh

### BEGIN INIT INFO

# Provides:          transmission-daemon

# Required-Start:    $remote_fs

# Required-Stop:     $remote_fs

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: Start or stop the transmission-daemon

# Description:       This file should be used to construct scripts to be

#                    placed in /etc/init.d.

### END INIT INFO


TRANSMISSION_BLOCKLISTS_DIRECTORY=/root/.config/transmission-daemon/blocklists


# Bluetack: badpeers

# http://www.iblocklist.com/list.php?list=bt_templist

wget -P $TRANSMISSION_BLOCKLISTS_DIRECTORY/ "http://list.iblocklist.com/?list=bt_templist&fileformat=p2p&archiveformat=gz"

rm -f $TRANSMISSION_BLOCKLISTS_DIRECTORY/bt_templist

gunzip $TRANSMISSION_BLOCKLISTS_DIRECTORY/bt_templist.gz


# Bluetack: level1

# http://www.iblocklist.com/list.php?list=bt_level1

wget -P $TRANSMISSION_BLOCKLISTS_DIRECTORY/ "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz"

rm -f $TRANSMISSION_BLOCKLISTS_DIRECTORY/bt_level1

gunzip $TRANSMISSION_BLOCKLISTS_DIRECTORY/bt_level1.gz


# The Blocklist Group: Primary Threats

# http://www.iblocklist.com/list.php?list=ijfqtofzixtwayqovmxn&fileformat=p2p&archiveformat=gz

wget -P $TRANSMISSION_BLOCKLISTS_DIRECTORY/ "http://list.iblocklist.com/?list=ijfqtofzixtwayqovmxn&fileformat=p2p&archiveformat=gz"

rm -f $TRANSMISSION_BLOCKLISTS_DIRECTORY/ijfqtofzixtwayqovmxn

gunzip $TRANSMISSION_BLOCKLISTS_DIRECTORY/ijfqtofzixtwayqovmxn.gz


# Do NOT "set -e"


# PATH should only include /usr/* if it runs after the mountnfs.sh script

PATH=/opt/sbin:/opt/bin:/sbin:/usr/sbin:/bin:/usr/bin

DESC="Transmission - daemon"

NAME=transmission-daemon

DAEMON=/opt/bin/$NAME

DAEMON_ARGS="--options args"

#PIDFILE=/var/run/$NAME.pid

SCRIPTNAME=/etc/init.d/$NAME

USER=root

STOP_TIMEOUT=3



# Exit if the package is not installed

[ -x "$DAEMON" ] || exit 0


[ -e /etc/default/$NAME ] && . /etc/default/$NAME


# Read configuration variable file if it is present

[ -r /etc/default/$NAME ] && . /etc/default/$NAME


# Load the VERBOSE setting and other rcS variables

. /lib/init/vars.sh


# Define LSB log_* functions.

# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.

. /lib/lsb/init-functions


#

# Function that starts the daemon/service

#

do_start()

{



    # Return

    #   0 if daemon has been started

    #   1 if daemon was already running

    #   2 if daemon could not be started


    if [ $ENABLE_DAEMON ! = 1 ] ; then

        log_progress_msg "(disabled, see /etc/default/${NAME})"

    else    

        start-stop-daemon --start \

        --chuid $USER \

        --exec $DAEMON -- $OPTIONS

    fi




    # Add code here, if necessary, that waits for the process to be ready

    # to handle requests from services started subsequently which depend

    # on this one.  As a last resort, sleep for some time.

}


#

# Function that stops the daemon/service

#

do_stop()

{

    # Return

    #   0 if daemon has been stopped

    #   1 if daemon was already stopped

    #   2 if daemon could not be stopped

    #   other if a failure occurred

    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME

    RETVAL="$?"

    [ "$RETVAL" = 2 ] && return 2

    # Wait for children to finish too if this is a daemon that forks

    # and if the daemon is only ever run from this initscript.

    # If the above conditions are not satisfied then add some other code

    # that waits for the process to drop all resources that could be

    # needed by services started subsequently.  A last resort is to

    # sleep for some time.

    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON

    [ "$?" = 2 ] && return 2

    # Many daemons don't delete their pidfiles when they exit.

    rm -f $PIDFILE

    return "$RETVAL"

}


#

# Function that sends a SIGHUP to the daemon/service

#

do_reload() {

    #

    # If the daemon can reload its configuration without

    # restarting (for example, when it is sent a SIGHUP),

    # then implement that here.

    #

    start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME

    return 0

}


case "$1" in

  start)

    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"

    do_start

    case "$?" in

        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;

        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;

    esac

    ;;

  stop)

    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"

    do_stop

    case "$?" in

        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;

        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;

    esac

    ;;

  #reload|force-reload)

    #

    # If do_reload() is not implemented then leave this commented out

    # and leave 'force-reload' as an alias for 'restart'.

    #

    #log_daemon_msg "Reloading $DESC" "$NAME"

    #do_reload

    #log_end_msg $?

    #;;

  restart|force-reload)

    #

    # If the "reload" option is implemented then remove the

    # 'force-reload' alias

    #

    log_daemon_msg "Restarting $DESC" "$NAME"

    do_stop

    case "$?" in

      0|1)

        do_start

        case "$?" in

            0) log_end_msg 0 ;;

            1) log_end_msg 1 ;; # Old process is still running

            *) log_end_msg 1 ;; # Failed to start

        esac

        ;;

      *)

          # Failed to stop

        log_end_msg 1

        ;;

    esac

    ;;

  *)

    #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2

    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2

    exit 3

    ;;

esac


: 



다음 아래의 명령어를 넣어준다

MyBookLive:~# chmod 755 /etc/init.d/transmission-daemon

MyBookLive:~# update-rc.d transmission-daemon defaults


그리고 다음 명령어로 실행한다.


MyBookLive:~# /etc/init.d/transmission-daemon start








반응형
반응형

기본적으로 MBL관련 강좌는 뽐뿌 NAS게시판에 자세히 정리되어있어 이곳을 참고하면 모든 것을 진행 할 수 있을 것이다.


일단 이미지의 썸네일을 만들어주는 orion 서비스를 Disable 시켜준다

속도 향상에 효과가 있다고 한다.

참고자료: http://www.clien.net/cs2/bbs/board.php?bo_table=lecture&wr_id=193734

http://mybookworld.wikidot.com/optware


1. Disable Orion Service


ssh에 접속하여 다음과 같이 진행한다.

orion process를 중단하고 Backup폴더로 옮기는 역할을 한다.


MyBookLive:~# cd /etc/init.d

MyBookLive:/etc/init.d# ./orion stop

MyBookLive:/etc/init.d# mkdir backup

MyBookLive:/etc/init.d# mv ./orion backup/


2. APTITUDE UPGRADE

mbl에는 기본적으로 앱관리 프로그램으로 apt-get, aptitude를 제공한다. 


ssh로 접근하여 다음과 같은 명령어를 실행한다

MyBookLive:~# aptitude safe-upgrade



3. OPTWARE 설치


APTITUDE와 마찬가지로 패키기 관리자라고 보면된다.


# wget http://mybookworld.wikidot.com/local--files/optware/setup-mybooklive.sh
# sh setup-mybooklive.sh

로 다운로드후

vim 으로 ~/.bashrc 파일을 열고 다음 한 줄을 추가한다


export PATH=$PATH:/opt/bin:opt/sbin:.


저장 후 source ~/.bashrc를 실행하여 반영시킨다


시작시 optware를 자동으로 실행시키기 위해서는 다음과 같이 명령어를 입력하면 된다.


chmod +x /etc/init.d/optware.sh
로 excution 권한을 주고
update-rc.d optware.sh defaults 90 01
로 스크립트에 등록해 주면 된다


반응형
반응형


My book Live에 새로운 기능을 추가하거나 관리하기 위해서는 


SSH를 통한 접근은 필수라고 할 수 있다. 


MBL에서 ssh세팅을 위해서는 다음과 같은 과정으로 진행된다.


1. MBL ssh enable 시키기


웹 브라우저를 열고 전 글에서 설정한 "IP주소 + /UI/ssh#"로 접근한다


http://192.168.0.103/UI/ssh#


그리고 아래와 같이 ssh 액세스 사용에 check하여 준다





2. SSH Client 설치하기


ssh접속을 위한 client로 putty와 같은 client가 많이 사용된다. 나는 넷사랑에서 나온 무료 라이센스 클라이언트를 사용하고자 한다

연구실에서 전부터 사용하여와서 인터페이스 및 기능이 많고 설정하여 사용하기에 편하다.


http://www.netsarang.co.kr/download/free_license.html


위의 주소로 접속하면 xShell 4 무료버전을 받을 수 있다. 받아 설치해 준다.



3. MBL에 SSH를 통해 접속하기


새로 만들기를 통해 MBL 새로운 세션을 등록하여준다

원하는 이름을 넣고 공유기에 설정한 IP주소를 호스트로 입력하고 

확인을 눌러 접속한다




사용자 ID와 비밀번호를 물어보는데

초기 ID/PW는 다음과 같다

ID: root

PW: welc0me



4. Root 비밀번호 변경하기

shell상에서 passwd 명령어를 통해 root 비밀번호는 반드시 변경하도록 한다.




반응형
반응형

저렴한  NAS의 한 종류로서 WD의  My Book Live를 저렴하게 구입하여 현재 사용하고자 한다.


앞으로 나의 MBL을 위한 Setting을 모두 공유하고 설정을 저장하고자 한다.




1. MBL 및 공유기 설정



 MBL은 기본적으로 다음과 같은 구조로  되어있다.


컴 ---------  공유기 ------------외부 인터넷

MBL---------┘



따라서 MBL의 손쉬운 사용을 위해 공유기의 설정을 다음과 같이 사용할 수 있다

공유기의 설정을 위해서는 다음과 같은 화면에서 게이트 웨이주소를 얻어오면 된다


Window Key + R ---> 실행 윈도우 오픈

cmd 입력

Ipconfig /all입력




공유기의 설정을 하기 위해 게이트 웨이 주소를 브라우저에 입력하면 공유기 설정을 진입할 수 있다.



1.1 MBL 내부 IP 고정하기


MBL의 접근을 공유기에서 MBL IP지정을 고정 하도록 설정한다

보통 공유기 마다 다르지만 DHCP 설정에 보면 IP 고정하는 설정이 있다.





1.2 포트포워딩(외부에서 MBL 접근하려면 필수)


외부에서 공유기를 거쳐 MBL로 접근하기 위해서는 공유기에서 포트 포워딩 설정이 필수 입니다.

설정메뉴에서 포트 포워딩 설정에가서 위에 고정으로 등록한 IP에 원하는 포트들을 포워딩 해 줍니다

DMZ와 같은 방법을 사용할 수도 있지만 보안상의 문제등으로 보통 포트 포워딩을 사용합니다.




저는 현재 FTP SFTP(SSH) HTTP 관련 포트 3개만 우선적으로 포워딩 하였습니다.



이로써 기본적인 공유기 설정은 마무리 되었다고 생각됩니다. 

각공유기별로 고유한 설정이나 부가기능들이 활용될 수 있을것입니다 각 공유기의 메뉴얼을 참고하시면 설정하는데 도움이 되실 것입니다.




반응형
반응형

간단하게 사용하고 있는 갤노트 10.1의 유용한 Link들을 모아본다.


0. ODIN 3.04

각종 Rom과 Flashing을 위해 사용되는 프로그램으로 첨부 파일로 첨부해 두겠다.

문제가 생기면 첨부파일은 제거될 수 있다.

odin3 v3.04.zip



1. CF-AUTO-Root : http://forum.xda-developers.com/showthread.php?t=1957002

노트 10.1의 루팅을 편하게 해주는 도구이다. 간단히 Ordin으로 Flash를 진행하면 Rooting이 완료된다.

SuperSU기반으로 On/Off를 통하여 은행어플도 사용가능하다. (su명령어와 SuperUser를 숨기는 기능을 해준다



2. TriangleAway : http://forum.xda-developers.com/showthread.php?t=1494114

노트 10.1에는 CustomRom을 사용할 경우를 Count하여 기록하는 Counter가 들어있다고 한다.

이러한 Count내용에 의거하여 삼성은 무료 A/S나 특정 Service를 제한하려 하는것 같다. 이러한 Counter를 초기화 해주는 프로그램이다. Google Play상에서도 설치 가능하나 유료로 되어있어 위의 주소에서는 직접 APK를 다운가능하도록 해준다.




반응형
반응형

Software Version Control을 위해 연구실에서 사용중인 Svn을 Visual Studio와 함께 사용하기 위하여


다음과 같이 플러그인을 깔아 설정하여 사용했다.


아래의 링크에 들어가 Plug-in 최신버젼을 받는다. 현재 VS 2012까지 지원하는 모양이다.


http://www.visualsvn.com/visualsvn/download/


모든 기능을 사용하기 위해서는 tortoisesvn도 깔려있어야 한다 같이 깔아주자


http://www.visualsvn.com/visualsvn/download/tortoisesvn/


Visual Studio가 켜있다면 끈 상태로 설치를 진행하자

설치는 큰 문제없이 진행할 수 있다.


1. Subversion URL 설정하기


(1) VisualSVN>Get Solution from Subversion 을 클릭한다



(2) URL과 이름 다운받고자하는 위치를 지정한다.




(3) OK를 누르면 자동으로 Check Out이 진행된다.



2. 사용하기


Check Out하여 사용하다보면 위와같이 노란색으로 수정되어 Commit될 부분이 표시된다


Commit을 원하는 폴더 혹은 파일을 우클릭 Commit하게 되면 다음과 같은 창과 함께 Commit할 수있다



Update및 Log보기도 위와 같은 방법으로 폴더 파일별로 우클릭후 사용하면된다.


전체 Solution별로 Commit및 Update가 가능하므로 그대로 사용하면 전체 프로젝트를 관리할 수 있다.






반응형
반응형





연구실에 이번에 새로 Cluster를 들이면서 여러가지 Setting을 하였다. 다음은 Rocks Cluster의 기본 메뉴얼 정도 되는

명령어 들의 정리이다.


System Power On/Off

부팅시, Master를 먼저 키고 Master가 다 켜지면, 각 노드들을 켜준다.
종료시, 노드들을 먼저 종료시키고 master를 꺼준다.

[root@master ~]# psh compute 'shutdown -h now'
[root@master ~]# shutdown -h now

User Add/Modify
Create Account
[root@master ~]# useradd test

Change password
[root@master ~]# passwd test

Cluster Sync -  모든 user관련 작업 수행뒤 세팅을 노드들에게 전달해야 하므로, 마지막에 반드시 수행해야한다.
[root@master ~]# rocks sync users

Monitoring
[root@master ~]# psh compute 'cat /proc/loadavg'
각 노드의 load avg를 출력하여 준다.

Individual execution nodes
각 노드를 선택하여 application을 구동한다.
[root@master ~]# psh node01, node02, node03 ./application.exe

Package installed on the entire node
전체 node에 같은 rpm을 동시에 설치하는 방법이다.
공유 디렉토리인 /export/apps폴더에 복사한다. 공유 마운트는 서버에 따라 다를 수 있다.
그리고 rpm을 전체에서 실행해 준다. 이때는 mount한 경로에서 실행해야 한다.(이경로는 ssh로 노드 접속시 나타나지 않았다)
기본적으로 /share/apps에 존재한다.

[root@master ~]# cp MyApp.rpm /export/apps/
[root@master ~]# psh compute 'rpm - Uvh /share/apps/MyApp.rpm'


Node List보기
[root@master ~]# rocks list host

HOST    MEMBERSHIP CPUS RACK RANK RUNACTION INSTALLACTION
master: Frontend   4    0    0    os        install     
node20: Compute    8    0    20   os        install     
node19: Compute    8    0    19   os        install     
node18: Compute    8    0    18   os        install     
...

Remote command
[root@master ~]# rocks run host node01 node02 ./application.exe






반응형
반응형

컴퓨터에서 종료되면 안되는 작업을 돌리고 집에 다녀오면

어느샌가 날려버리는 일이 있었습니다 .

shell 작업 같은 경우는 shell 이 꺼짐과 동시에 모든 작업이 멈추기 때문에

윈도우의 재부팅을 임시적으로 막는 방법 입니다

  1. 관리자권한으로 명령프롬프트 실행

   

화면 캡처: 2012-04-06 오후 3:10

  1. 다 음 과 같 이 t y p e 해 줍 니 다

    시작 > 보조프로그램 > 명령 프롬프트 마우스 오른쪽 관리자 권한으로 실행

     

  2. 그럼 다음과 같이 업데이트 서비스가 정지 되고 업데이트에 의한 재부팅이 발생 하지 않는다

 

   

   

화면 캡처: 2012-04-06 오후 3:13

   

수동 재부팅시 서비스가 다시 시작하니 걱정하실 것 없습니다

반응형
반응형

연구실에서 MultiProcessor로 구성되어있는 Processor를 Full로 돌려서,  사용할 일이 있는데
처음에는 Bash shell의 &를 통한, 간단한 구현으로 여러 Process를 돌렸다. 하지만
시간이 약간씩 Loss가 되는(여러작업을 Continuous하게 돌리기 때문에) 일이 발생하였다.
그래서
fork()함수와 execl()함수를 이용한, 여러 Process를 Countinous하게 구동하는 예제를 작성하였다.

TOTAL_PS 는 전체 Process의 개수
NUM_PARA_PS는 동시에 진행할 Process의 개수를 의미한다.

fork()함수는 동일한 child process를 하나더 return하며, Pid가 0인것으로 child와 그렇지 않은 process를 구분한다.

exelc()는 다른 프로그램을 실행해 주는 것으로, exelc(경로, 이름, args, NULL)과 같은 형태로 사용한다.

예제
###c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

#define TOTAL_PS 9
#define NUM_PARA_PS 4


int main(int argc, char** argv)
{
  pid_t pids[TOTAL_PS];
    char num[10] = "123456789";
    char * args;
  int i;
  int n = NUM_PARA_PS; 

  for(i = 0; i < n ; i++)
    {
            if((pids[i] = fork()) < 0 ){
                perror("fork");
                return -1;
            }
            else if(pids[i] == 0) {
                args = (char*)malloc(sizeof(char));
                args[0] = num[i];
                execl("./clock", "clock", args, NULL);
                printf("%c\n", num[i]);
                exit(0);
            }
    }

    int status;
    pid_t pid;
    int num_run_ps = NUM_PARA_PS;

    while( (num_run_ps) != TOTAL_PS ) {
        pid = wait(&status);
        printf("Child with PID %ld exited with status 0x%x.\n", (long)pid, status);
        if((pids[num_run_ps] = fork()) < 0) {
            perror("fork");
            return -1;
        }
        else if(pids[num_run_ps] == 0) {
            args = (char*)malloc(sizeof(char));
            args[0] = num[num_run_ps];
            execl("./clock", "clock", args, NULL);
            printf("%c\n", num[i]);
            exit(0);
        }
        num_run_ps++;
    }

    for(i = 0; i < NUM_PARA_PS; i++)
        {
            pid = wait(&status);
            printf("Child with PID %ld exited with status 0x%x.\n", (long)pid, status);
        }
}








반응형

+ Recent posts