Linux2017. 8. 24. 11:30


자동으로 제한하는 스크립트/데몬 - cpulimit 이용

[링크 : http://www.myservlab.com/59]

[링크 : https://www.maketecheasier.com/limit-cpu-usage-of-any-process-in-linux/]


ulimit / limits.conf

[링크 : http://linux.systemv.pe.kr/리눅스-시스템-자원-제한/]


ulimit

[링크 : http://faq.hostway.co.kr/Linux_ETC/7179]

[링크 : https://stackoverflow.com/questions/978317/ulimit-t-under-ubuntu]


ulimit -Sa 소프트 제한 (-a 기본값)

ulimit -Ha 하드 제한

[링크 : http://blog.naver.com/dudwo567890/130156432746]

[링크 : http://coffeenix.net/board_print.php?bd_code=146]

-t : CPU의 초당 사용시간 제한

[링크 : http://blog.cafe24.com/1921]


-t는 그 시간만큼 돌아가면 프로세스를 죽여버리는 듯(무한 루프 방지 용도)

[링크 : https://unix.stackexchange.com/.../can-i-limit-a-process-to-a-certain-amount-of-time-cpu-cycles]

'Linux' 카테고리의 다른 글

mount -o codepage=cp949  (0) 2018.01.04
taint kernel?  (0) 2017.12.03
elf 파일에서 컴파일러 버전 알아내기  (0) 2017.06.07
top VIRT?  (0) 2017.05.10
cpulimit 백그라운드 실행 이유  (0) 2017.05.10
Posted by 구차니
Linux2017. 6. 7. 15:33



[링크 : https://stackoverflow.com/.../how-to-retrieve-the-gcc-version-used-to-compile-a-given-elf-executable]

'Linux' 카테고리의 다른 글

taint kernel?  (0) 2017.12.03
limits.conf와 ulimit  (0) 2017.08.24
top VIRT?  (0) 2017.05.10
cpulimit 백그라운드 실행 이유  (0) 2017.05.10
wget 로그인 정보 설정  (0) 2017.04.17
Posted by 구차니
Linux/Ubuntu2017. 5. 23. 15:32

$ sudo hdparm -S 값 장치명

1~240 / 5초 (5초 ~ 20분)

241~251 / 30분 (30분 ~ 5시간 30분)

252 / 21분?

253 / 업체별 상이 (8~ 12시간)

254 / reserved

255 / 21분 15초



 -S Put the drive into idle (low-power) mode, and also set the

              standby (spindown) timeout for the drive. This timeout value is

              used by the drive to determine how long to wait  (with  no  disk
              activity)  before  turning  off the spindle motor to save power.
              Under such circumstances, the drive  may  take  as  long  as  30
              seconds  to  respond  to  a  subsequent disk access, though most
              drives are much quicker.  The encoding of the timeout  value  is
              somewhat   peculiar.   A  value  of  zero  means  "timeouts  are
              disabled": the device will not automatically enter standby mode.
              Values  from  1  to 240 specify multiples of 5 seconds, yielding
              timeouts from 5 seconds to 20 minutes.  Values from 241  to  251
              specify from 1 to 11 units of 30 minutes, yielding timeouts from
              30 minutes to 5.5 hours.  A value of 252 signifies a timeout  of
              21  minutes. A value of 253 sets a vendor-defined timeout period
              between 8 and 12 hours, and the value 254 is reserved.   255  is
              interpreted as 21 minutes plus 15 seconds.  Note that some older
              drives may have very different interpretations of these values.

[링크 : http://manpages.ubuntu.com/manpages/zesty/en/man8/hdparm.8.html]


[링크 : https://askubuntu.com/questions/39760/how-can-i-control-hdd-spin-down-time]

[링크 : http://www.spencerstirling.com/computergeek/powersaving.html]

[링크 : https://wiki.archlinux.org/index.php/Power_management]

    [링크 : https://wiki.archlinux.org/index.php/Hdparm#Power_management_configuration]

'Linux > Ubuntu' 카테고리의 다른 글

리눅스 팩스 서버 구축?  (0) 2018.02.09
cgroups  (0) 2017.08.24
cpulimit / resource quota  (0) 2017.02.15
우분투 루트 인증서 업데이트 내역  (0) 2017.01.18
우분투 창 관리 - 윈7처럼 창분할 단축키  (0) 2017.01.09
Posted by 구차니
Linux2017. 5. 10. 16:49

봐도 모르겠다 -ㅁ-

VIRT는 해당 프로그램에서 사용하는 전체 메모리 용량을 지칭하는 것 같고

(공유 메모리, 스택, 힙, 다이나믹 라이브러리 등등등)

RES는 스왑등에 의해서 내려지고 남은 "실제 물리 메모리에 적재된" 용량을 의미하는 것 같다.


VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card’s RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.


RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column.) This will virtually always be less than the VIRT size, since most programs depend on the C library.


SHR indicates how much of the VIRT size is actually sharable (memory or libraries). In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES. 

[링크 : http://mugurel.sumanariu.ro/linux/the-difference-among-virt-res-and-shr-in-top-output/]

    [링크 : https://serverfault.com/questions/138427/top-what-does-virtual-memory-size-mean-linux-ubuntu]

'Linux' 카테고리의 다른 글

limits.conf와 ulimit  (0) 2017.08.24
elf 파일에서 컴파일러 버전 알아내기  (0) 2017.06.07
cpulimit 백그라운드 실행 이유  (0) 2017.05.10
wget 로그인 정보 설정  (0) 2017.04.17
원격지 mac address 얻기  (0) 2017.03.13
Posted by 구차니
Linux2017. 5. 10. 16:35

막상 cpu 꾸준히 먹는 놈이 없어서 안해봤는데

오늘 해보니..


cpulimit이 작동되는 동안에만 해당 설정이 적용되고

한번에 뚝! 떨어지는게 아니라 점진적으로 설정값에 수렴을 하는 식으로 내려간다.

그리고 cpulimit을 종료하면 원래 설정대로 cpu를 냠냠 해주신다.


[링크 : http://knight76.tistory.com/entry/cpulimit-cpu-사용량을-정한다]

'Linux' 카테고리의 다른 글

elf 파일에서 컴파일러 버전 알아내기  (0) 2017.06.07
top VIRT?  (0) 2017.05.10
wget 로그인 정보 설정  (0) 2017.04.17
원격지 mac address 얻기  (0) 2017.03.13
리눅스 쉘에서 시리얼 포트로 쓰기  (0) 2017.02.15
Posted by 구차니
Linux2017. 4. 17. 16:39

세션 쿠키를 정보를 저장해서 하는 것도 있겠지만

[링크 : http://damduc.tistory.com/254]


       --load-cookies file

           Load cookies from file before the first HTTP retrieval.  file is a

           textual file in the format originally used by Netscape's

           cookies.txt file.


       --save-cookies file
           Save cookies to file before exiting.  This will not save cookies
           that have expired or that have no expiry time (so-called "session
           cookies"), but also see --keep-session-cookies.

       --keep-session-cookies

           When specified, causes --save-cookies to also save session cookies.

           Session cookies are normally not saved because they are meant to be

           kept in memory and forgotten when you exit the browser.  Saving

           them is useful on sites that require you to log in or to visit the

           home page before you can access some pages.  With this option,

           multiple Wget runs are considered a single browser session as far

           as the site is concerned.

           Since the cookie file format does not normally carry session

           cookies, Wget marks them with an expiry timestamp of 0.  Wget's

           --load-cookies recognizes those as session cookies, but it might

           confuse other browsers.  Also note that cookies so loaded will be

           treated as other session cookies, which means that if you want

           --save-cookies to preserve them again, you must use

           --keep-session-cookies again. 


로그인 정보 넘겨서 매번 하는것도 머 방법이니까?


       --user=user

       --password=password

           Specify the username user and password password for both FTP and

           HTTP file retrieval.  These parameters can be overridden using the

           --ftp-user and --ftp-password options for FTP connections and the

           --http-user and --http-password options for HTTP connections. 

[링크 : https://linux.die.net/man/1/wget]

'Linux' 카테고리의 다른 글

top VIRT?  (0) 2017.05.10
cpulimit 백그라운드 실행 이유  (0) 2017.05.10
원격지 mac address 얻기  (0) 2017.03.13
리눅스 쉘에서 시리얼 포트로 쓰기  (0) 2017.02.15
리눅스 파일 시간관련  (0) 2017.01.01
Posted by 구차니
Linux2017. 3. 13. 16:29

fing이 좋아 보이나 어떤 특정 유틸리티인것 같고

ubuntu쪽에서 패키지로 보이는건 arping 정도 뿐인 듯..

(nmap은 쓰기 어려우니 일단 패스)


[링크 : http://unix.stackexchange.com/questions/120153/resolving-mac-address-from-ip-address-in-linux]

[링크 : https://superuser.com/questions/188799/how-to-find-the-mac-address-of-a-remote-computer]



$ apt-cache search arping

arping - sends IP and/or ARP pings (to the MAC address) 

[링크 : https://linux.die.net/man/8/arping]



설마.. 이 Fing ip 스캐너 인가?

[링크 : https://www.fing.io/download-free-ip-scanner-for-desktop-linux-windows-and-osx/]


+

2017.03.14

라즈베리로 하는데...

안되는데?!? arping?!??!


$ sudo arping -c 1 host

'Linux' 카테고리의 다른 글

cpulimit 백그라운드 실행 이유  (0) 2017.05.10
wget 로그인 정보 설정  (0) 2017.04.17
리눅스 쉘에서 시리얼 포트로 쓰기  (0) 2017.02.15
리눅스 파일 시간관련  (0) 2017.01.01
ctime mtime.. 엌?!  (0) 2016.12.31
Posted by 구차니
Linux2017. 2. 15. 19:31

약간 다른 상황이지만..

임베디드 리눅스에서 minicom도 없고 screen도 없어서

순수(?) 터미널로만 받는 방법 찾게 됨

 

stty -speed 19200 -f /dev/ttyS1

 

echo -ne '\033[2J' > /dev/ttyS1

cat -v < /dev/ttyS1 

[링크 : http://unix.stackexchange.com/questions/117037/how-to-send-data-to-a-serial-port-and-see-any-answer]

 

일단 안되서! 명령어 도움말을 보니

# stty --help

BusyBox v1.20.2 (2015-12-21 15:35:08 KST) multi-call binary.

 

Usage: stty [-a|g] [-F DEVICE] [SETTING]...

 

Without arguments, prints baud rate, line discipline,

and deviations from stty sane

 

        -F DEVICE       Open device instead of stdin

        -a              Print all current settings in human-readable form

        -g              Print in stty-readable form

        [SETTING]       See manpage 

 

# stty -a -F /dev/ttyAMA2

speed 9600 baud;stty: /dev/ttyAMA2

 line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke 

 

# stty -F /dev/ttyAMA2 speed 115200

9600 

 

# stty -a -F /dev/ttyAMA2

speed 115200 baud;stty: /dev/ttyAMA2

 line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;

werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke 

 

putty에서 시리얼 열어 놓고

baudrate 맞추고 하니 잘 된다.

다만.. 232가 아닌 485라.. RX만 확인하고 TX는 아직 미확인 ㅠㅠ

 

 

+

바로 종료되서 글씨가 안나오면 아래와 같이 타임아웃 시간을 늘려주는 것이 방법이다.

# stty -F /dev/ttyAMA2 min 0 time 10 

 

[링크 : http://stackoverflow.com/questions/6713668/how-i-can-read-tty-file-with-timeout]

 

 

+

2021.02.18

부등호 방향에 유의 ㅠㅠ

stty 115200 < /dev/ttyS0

[링크 : https://iam777.tistory.com/490]

'Linux' 카테고리의 다른 글

wget 로그인 정보 설정  (0) 2017.04.17
원격지 mac address 얻기  (0) 2017.03.13
리눅스 파일 시간관련  (0) 2017.01.01
ctime mtime.. 엌?!  (0) 2016.12.31
base64 유틸리티  (0) 2016.12.28
Posted by 구차니
Linux/Ubuntu2017. 2. 15. 14:50

음.. 프로세스 별로 처리인가?

유저별로 제한이라던가 하는 기능은 없나보네..


$ cpulimit

Error: You must specify a target process

CPUlimit version 2.1

Usage: cpulimit TARGET [OPTIONS...] [-- PROGRAM]

   TARGET must be exactly one of these:

      -p, --pid=N        pid of the process

      -e, --exe=FILE     name of the executable program file

                         The -e option only works when

                         cpulimit is run with admin rights.

      -P, --path=PATH    absolute path name of the

                         executable program file

   OPTIONS

      -b  --background   run in background

      -c  --cpu=N        override the detection of CPUs on the machine.

      -l, --limit=N      percentage of cpu allowed from 1 up.

                         Usually 1 - 400, but can be higher

                         on multi-core CPUs (mandatory)

      -q, --quiet        run in quiet mode (only print errors).

      -k, --kill         kill processes going over their limit

                         instead of just throttling them.

      -r, --restore      Restore processes after they have

                         been killed. Works with the -k flag.

      -s, --signal=SIG   Send this signal to the watched process when cpulimit exits.

                         Signal should be specificed as a number or

                         SIGTERM, SIGCONT, SIGSTOP, etc. SIGCONT is the default.

      -v, --verbose      show control statistics

      -z, --lazy         exit if there is no suitable target process,

                         or if it dies

          --             This is the final CPUlimit option. All following

                         options are for another program we will launch.

      -h, --help         display this help and exit 


[링크 : http://cpulimit.sourceforge.net/]

[링크 : https://www.howtoforge.com/how-to-limit-cpu-usage-with-cpulimit-on-ubuntu-linux]

[링크 : https://www.digitalocean.com/community/tutorials/how-to-limit-cpu-usage-on-ubuntu-12-10]

[링크 : http://manpages.ubuntu.com/manpages/precise/man1/cpulimit.1.html]



+

ulimit을 통해 전체 시스템에 대해서 일괄적으로 cpu및 메모리 등의 용량 제한을 걸 수 있는 듯?


[링크 : http://www.linuxquestions.org/questions/linux-server-73/how-to-limit-the-users-cpu-usage-617928/]

    [링크 : http://www.linuxquestions.org/questions/debian-26/how-to-limit-the-cpu-usage-per-user-715490/]

[링크 : http://stackoverflow.com/questions/437433/limit-the-memory-and-cpu-available-for-a-user-in-linux]

[링크 : https://linux.die.net/man/3/ulimit]


<item>

core

limits the core file size (KB)

data

maximum data size (KB)

fsize

maximum filesize (KB)

memlock

maximum locked-in-memory address space (KB)

nofile

maximum number of open files

rss

maximum resident set size (KB) (Ignored in Linux 2.4.30 and higher)

stack

maximum stack size (KB)

cpu

maximum CPU time (minutes)

nproc

maximum number of processes

as

address space limit (KB)

maxlogins

maximum number of logins for this user except for this with uid=0

maxsyslogins

maximum number of all logins on system

priority

the priority to run user process with (negative values boost process priority)

locks

maximum locked files (Linux 2.4 and higher)

sigpending

maximum number of pending signals (Linux 2.6 and higher)

msgqueue

maximum memory used by POSIX message queues (bytes) (Linux 2.6 and higher)

nice

maximum nice priority allowed to raise to (Linux 2.6.12 and higher) values: [-20,19]

rtprio

maximum realtime priority allowed for non-privileged processes (Linux 2.6.12 and higher) 


[링크 : https://linux.die.net/man/5/limits.conf]

'Linux > Ubuntu' 카테고리의 다른 글

cgroups  (0) 2017.08.24
리눅스 하드 절전 설정  (0) 2017.05.23
우분투 루트 인증서 업데이트 내역  (0) 2017.01.18
우분투 창 관리 - 윈7처럼 창분할 단축키  (0) 2017.01.09
crontab 과 cron 서비스 reload  (0) 2017.01.04
Posted by 구차니
Linux/Ubuntu2017. 1. 18. 18:45

읭? 오늘 오랫만에 라즈베리 업데이트 하는데 먼가 멈춰있길래 봤더니

루트인증서 업데이트 인 듯?


음.. 빠진건 왜 빠졌을까? WoSign 계열 파동의 여파일려나?


  Update Mozilla certificate authority bundle to version 2.9.

    The following certificate authorities were added (+):

    + "Certplus Root CA G1"

    + "Certplus Root CA G2"

    + "Certum Trusted Network CA 2"

    + "Hellenic Academic and Research Institutions ECC RootCA 2015"

    + "Hellenic Academic and Research Institutions RootCA 2015"

    + "ISRG Root X1"

    + "OpenTrust Root CA G1"

    + "OpenTrust Root CA G2"

    + "OpenTrust Root CA G3"

    + "SZAFIR ROOT CA2"

    The following certificate authorities were removed (-):

    - "CA Disig"

    - "NetLock Business (Class B) Root"

    - "NetLock Express (Class C) Root"

    - "NetLock Notary (Class A) Root"

    - "NetLock Qualified (Class QA) Root"

    - "Sonera Class 1 Root CA"

    - "Staat der Nederlanden Root CA"

    - "Verisign Class 1 Public Primary Certification Authority - G2"

    - "Verisign Class 3 Public Primary Certification Authority"

    - "Verisign Class 3 Public Primary Certification Authority - G2"


 -- Michael Shuler <michael@pbandjelly.org>  Fri, 18 Nov 2016 09:09:47 -0600 


Posted by 구차니