구슬이네 IT & Media / IT 와 미디어를 바라봅니다



홈페이지를 옮겨서 새주소 바로가기를 알려드립니다.


http://studium.tistory.com/163



crontab 옵션

IT 개발/OS-LINUX 2012. 8. 29. 18:28


참고문서 : http://panic910.tistory.com/27\

crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }

-l : 현재 cron table을 보여 줌
-r : 현재 cron table을 삭제
-e : 현재 cron table을 편집
-u user : user 사용자에 대해서 crontab 작업을 수행한다.

cron table의 각 필드값 설명

| 분 | 시간 | 날짜 | 달 | 요일 | 사용자 | 명령 |

 1 2 3 4 5           program

 1 : minute (0-59),
 2 : hour (0-23),
 3 : day of the month (1-31),
 4 : month of the year (1-12),
 5 : day of the week (0-6 with 0=Sunday).

''*''  :  everytime
''-''  :  범위 지정, 1-5이면 1시와 5시 사이
'',''  :  분리자, 시간으로 예를 들면 1,3이면 1시와 3시
 /     :  시간에서 20-9/3이라면 20시부터 09시까지 매 3시간마다라는 뜻

저작자 표시 비영리 변경 금지

 추가정보

참고문서 : 

http://jangjeonghun.tistory.com/201





내용보기


tar -tvf 파일명

 

특정파일만 풀기

zcat 압축파일명 |tar xvf - 풀어야할파일명

 



참고문서 : http://wiki.openwrt.org/doc/howto/lamp

 

root@OpenWrt:/mnt/usb1# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                30.4M      8.7M     21.7M  28% /
tmpfs                    30.2M     76.0K     30.2M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/mnt/usb1#

 

root@OpenWrt:/mnt/usb1# opkg update
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
root@OpenWrt:/mnt/usb1#

 

root@OpenWrt:/mnt/usb1# opkg install libpthread libncurses libreadline mysql-server
Package libpthread (0.9.30.1-43.32) installed in root is up to date.
Installing libncurses (5.7-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libncurses_5.7-2_ar71xx.ipk.
Installing libreadline (5.2-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libreadline_5.2-2_ar71xx.ipk.
Installing mysql-server (5.1.53-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/mysql-server_5.1.53-2_ar71xx.ipk.
Installing libmysqlclient (5.1.53-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libmysqlclient_5.1.53-2_ar71xx.ipk.
Installing uclibcxx (0.2.2-3) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/uclibcxx_0.2.2-3_ar71xx.ipk.
Configuring libmysqlclient.
Configuring uclibcxx.
Configuring mysql-server.
Configuring libreadline.
Configuring libncurses.
root@OpenWrt:/mnt/usb1# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                30.4M     12.1M     18.3M  40% /
tmpfs                    30.2M      1.5M     28.7M   5% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/mnt/usb1#

root@OpenWrt:~# sed -i 's,^datadir.*,datadir         = "/srv/mysql",g' /etc/my.cnf
root@OpenWrt:~#
root@OpenWrt:~# sed -i 's,^tmpdir.*,tmpdir          = "/tmp",g' /etc/my.cnf

 

root@OpenWrt:~# mkdir -p /srv/mysql
root@OpenWrt:~# mysql_install_db --force
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h OpenWrt password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/scripts/mysqlbug script!

root@OpenWrt:~#

root@OpenWrt:~# /etc/init.d/mysqld start
Starting MySQL daemon... done
root@OpenWrt:~# /etc/init.d/mysqld enable

mysqladmin -u root password 'new-password'
 

root@OpenWrt:~# opkg update
opkg install php5-mod-mysqlDownloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
root@OpenWrt:~# opkg install php5-mod-mysql
Installing php5-mod-mysql (5.3.6-3.3) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/php5-mod-mysql_5.3.6-3.3_ar71xx.ipk.
Configuring php5-mod-mysql.
root@OpenWrt:~#

root@OpenWrt:~# sed -i 's,;extension=mysql.so,extension=mysql.so,g' /etc/php.ini
root@OpenWrt:~#

 

root@OpenWrt:~# netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2331/mysqld
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1525/uhttpd
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      1555/vsftpd
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      1550/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1512/dropbear
tcp        0     48 192.168.1.1:22          210.115.223.46:58963    ESTABLISHED 2283/dropbear
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:53              0.0.0.0:*                           1550/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1550/dnsmasq
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  6      [ ]         DGRAM                       260 303/syslogd         /dev/log
unix  2      [ ACC ]     STREAM     LISTENING       3849 2331/mysqld         /var/run/mysqld.sock
unix  2      [ ]         DGRAM                      1054 835/hostapd         /var/run/hostapd-phy0/wlan0
unix  2      [ ACC ]     STREAM     LISTENING       3695 2283/dropbear       /tmp/dropbear-ad87d49d/auth-59b4374a-7
unix  2      [ ]         DGRAM                      1878 835/hostapd        
unix  2      [ ]         DGRAM                      1670 1550/dnsmasq       
unix  2      [ ]         DGRAM                      1629 1512/dropbear      
unix  2      [ ]         DGRAM                       265 305/klogd          
root@OpenWrt:~#

 

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                30.4M     12.5M     17.9M  41% /
tmpfs                    30.2M      1.5M     28.7M   5% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~#

mysql –uroot –p패스워드 하면 잘된다.



1. 무선네트워크 켜기

공유기에서 Network-Wifi 쪽 꺼져있는걸 켜면됨

2. SSID 이름 바꾸기

Network-Wifi 들어가서 SSID 변경

3. Security 방법 선택하고 비밀번호 설정하기

4. 포트포워딩 (외부에서 내부 네트워크로 들어오게 하는 방법)

http://blog.shar.kr/1026

5. ddns 서비스를 이용해서 도메인으로 접속하게 하기 ==> 잘됨

마이크로소프트 5월호 참고

6. OpenWrt에서 USB 인식시키기

http://blog.shar.kr/1024

http://blog.naver.com/PostView.nhn?blogId=min6113&logNo=90024158860&redirect=Dlog&widgetTypeCall=true

http://wiki.openwrt.org/doc/howto/usb.storage

http://hook.tistory.com/m/post/view/id/284

http://openwrt.ssu.ac.kr/bbs/board.php?bo_table=OpenWrt_QnA&wr_id=487

리눅스에서 FAT나 EXT3등으로 외장하드 포맷하기

http://blog.naver.com/synth9?Redirect=Log&logNo=130094707512

FAT로 인식시켜서 윈도우에서도 인식시키고, 리눅스에서도 인식시키자.

윈도우에서는 Partition Wizard로 FAT로 포맷 (Fat으로 하니까 파티션이 두개나오는데 FAT32로 하니까 하나로 잘됨)

mount -t vfat /dev/sda1 /mnt/usb1 -o rw,sync

USB뺄때는

umount /dev/sda1

USB 인식도 잘됨, 당분간은 FTP로 파일 업,다운으로 해야겠음.

7. FTP 설치하기

잘됨

http://blog.shar.kr/entry/OpenWRT-%EA%B3%B5%EC%9C%A0%EA%B8%B0%EC%97%90-FTP%EC%84%9C%EB%B2%84-%EA%B5%AC%EC%B6%95%ED%95%98%EA%B8%B0

8. lighttpd 설치하기

잘됨

실행

/etc/init.d/lighttpd start 

설치한후에 외부에서 들어가려면 network-firewall 에서 포트포워딩 81번 포트 추가해줌

임베디드 리눅스시스템 구축 및 응용 참고

디렉터리 보안기능 추가

root@OpenWrt:/mnt/usb1/OS_WWW/PROGRAM# opkg update
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
root@OpenWrt:/mnt/usb1/OS_WWW/PROGRAM# opkg install lighttpd-mod-auth
Installing lighttpd-mod-auth (1.4.28-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/lighttpd-mod-auth_1.4.28-2_ar71xx.ipk.
Configuring lighttpd-mod-auth.
root@OpenWrt:/mnt/usb1/OS_WWW/PROGRAM#

설정은 다음 참고

http://hook.tistory.com/289

9. vi에서 한글이 깨지는 문제 해결하기

어떻게 해야 되나?

 

10. PHP 설치

잘됨

임베디드 리눅스시스템 구축 및 응용 참고

 

11. DB설치

mysql ? litesql ?

 

12. 파일공유 (SAMBA) --> 윈도 PC에서 읽기는 되는데 아직 쓰기가 안되네요. 

윈도우에서 리눅스파일을 공유폴더로 접근해보자

삼바란?

http://eincs.net/2010/03/file-transfer-between-window-unix-with-samba/

삼바 재시작

smbd restart

삼바 시작

smbd -D

확인

netstat -nap

윈도우 Xp에서는 아주 잘 되고 윈도우 2008에서 접속이 안되네

이것저것 해보고 있는중

http://songeehana.blog.me/40154128760

http://www.coffeedust.com/2010/07/windows-vista-home.html

http://www.petri.co.il/how-to-disable-smb-2-on-windows-vista-or-server-2008.htm

 http://takuma99.tistory.com/166

 

==> XP에서는 수정은 안되도 읽기는 잘 됬는데, 윈도우7에서는 기본적으로 안된다..

제어판 > guest 계정을 사용으로 변경


13. 시작 프로그램 등록

 

/etc/rc.local

 

에 명령어 추가하면 시작시 실행됨

 

 

* 참고문서

http://hook.tistory.com/288#trackback8350355

'IT 개발 > OS-LINUX' 카테고리의 다른 글

tar 옵션 (파일내용보기, 특정파일만 풀기)  (0) 2012.08.10
openwrt에서 mysql설치해보자  (1) 2012.05.30
페도라코어8이상에서 ssh포트문제  (0) 2011.08.23
리눅스 SSH 활용  (0) 2011.08.23
tail 사용하기  (0) 2011.03.10



/etc/ssh/sshd_config

파일에서 포트를 3000 으로 지정하고 sshd 재시작했는데 서비스가 시작되지 않는다. 

tail -f /var/log/secure

해서 service sshd restart 했을때 로그를 보니

error: BInd to port 3000 on :: failed: Permission denied.
fatal: Cannotbind any address.

라고 나온다.

왜 이전버전에서는 되던것이 8버전에서는 Permission denied를 나게 한걸까?

 

다른데도 유사한 에러가 나네

http://linuxchannel.net/board/read.php?table=qna&no=8023

★ 에러가 나는 이유는 다음의 이유가 아닐까 강력하게 의심이 된다.

/ets/services 에는 서비스별 포트와 서비스명이 적혀있다.
그런데 페도라4보다 페도라8에서 훨씬 더 많은 서비스들이 기술되어 있다.
즉 내가 바꿨던 포트인 3000 , 8000 , 9000 등은 /etc/services 에 기술되어 있어서
여기에 서술된 포트를 ssh에서 쓰려고 하면 sshd가 에러나면서 시작을 못하는것이
아닐까 싶다.
hbci 3000/tcp # HBCI hbci 3000/udp # HBCI
irdmi 8000/tcp # iRDMI irdmi 8000/udp # iRDMI
cslistener 9000/tcp # CSlistener cslistener 9000/udp # CSlistener 
그러나 안맞는 경우도 있었다. /etc/services 에 기술안된 포트인데 쓰려고하면
안된경우도 있었고 (31000 포트)
etc/service 에 있는 기존 포트를 주석처리하고 쓰려고 해도 실패했다.

단 /etc/service에 있는 포트는 반드시 피해서 사용해야 하는 것은 맞는것 같다.



 

'IT 개발 > OS-LINUX' 카테고리의 다른 글

openwrt에서 mysql설치해보자  (1) 2012.05.30
OpenWRT설정 (현재 내가 쓰고 있는 설정)  (0) 2012.05.18
리눅스 SSH 활용  (0) 2011.08.23
tail 사용하기  (0) 2011.03.10
vi에디터 사용하기  (0) 2011.03.09




자료출처 : http://wowlinux.com/download/spec
글쓴이: 이종준 작성 일시: 목, 2002/03/07 - 9:39오전
자료출처 : http://wowlinux.com/download/specialview.html?db=special&id=69&view=1

ssh 사용 팁

ssh 를 여러가지로 활용하여 사용할 수 있습니다. 더 자세한 것들은 man ssh 를 하여 메뉴얼 페이지를 보십시요. 먼저 아래와 같이 하면 서버에 있는 파일을 로컬로 복사 할 수 있습니다.

#ssh user@remote.com dd if=remotefilename | dd of=localfiename

다음과 같이 하면 서버의 파일을 로컬의 /dev/fd0 장치 드라이버에 기록할 수 있습니다.

#ssh user@remote.com dd if=remotefilename | dd of=/dev/fd0

아래의 방법은 현재의 디렉토리를 압축하여 서버의 junilove 계정의 홈디렉토리에 my_local_backup.tar.gz 에 기록합니다.

#tar cfz - . | ssh junilove@yourmachine.com dd of=my_local_backup.tar.gz

»

'IT 개발 > OS-LINUX' 카테고리의 다른 글

openwrt에서 mysql설치해보자  (1) 2012.05.30
OpenWRT설정 (현재 내가 쓰고 있는 설정)  (0) 2012.05.18
페도라코어8이상에서 ssh포트문제  (0) 2011.08.23
tail 사용하기  (0) 2011.03.10
vi에디터 사용하기  (0) 2011.03.09



아파치 등 웹서버에서 로그파일을 실시간을 볼 때 tail을 많이 사용합니다. 

특히 -f 옵션을 사용하면 파일을 모니터링하고 있다가 변경사항만 보여주기 때문에 편합니다. 

tail -f "파일명"


*. 이미지 파일 빼고 특정확장자 파일만 보기

그냥 보면 이미지 파일들까지 로그에 다 찍히기 때문에 프로그램 페이지만 골라보기가 어려운데 이럴때 grep을 이용하면 특정 확장자파일만 볼 수 있어서 편리합니다.

tail -f /usr/local/apache/logs/access_log | grep 'php'

'IT 개발 > OS-LINUX' 카테고리의 다른 글

openwrt에서 mysql설치해보자  (1) 2012.05.30
OpenWRT설정 (현재 내가 쓰고 있는 설정)  (0) 2012.05.18
페도라코어8이상에서 ssh포트문제  (0) 2011.08.23
리눅스 SSH 활용  (0) 2011.08.23
vi에디터 사용하기  (0) 2011.03.09



저는 에디트 플러스를 제일 많이 쓰고

이클립스에서 ssh로 php파일을 수정하는 방법을 찾아보려고 하는데요.

가끔 어쩔수없이 vi를 사용해야 할 때가 아직 많이 있습니다.

그래서 vi 에디터 사용법을 정리해 놓으려고 합니다.



많이 쓰는 단축키중에 유용한 단축키 :

1. 화면분할

vi 에디터에서 단축키

ctrl + w v : 수직창 나누기 (명령어는 : vs)
ctrl + w s : 수평창 나누기 (명령어는 : sp)

ctrl + w w : 창 사이 이동


분할된 창을 닫을 때

q! 하면 현재 부분이 닫히면서 분할이 없어짐


2. 다른파일 열기

e aaa.txt
e [디렉토리]

현재 폴더를 열 때
e .

'IT 개발 > OS-LINUX' 카테고리의 다른 글

openwrt에서 mysql설치해보자  (1) 2012.05.30
OpenWRT설정 (현재 내가 쓰고 있는 설정)  (0) 2012.05.18
페도라코어8이상에서 ssh포트문제  (0) 2011.08.23
리눅스 SSH 활용  (0) 2011.08.23
tail 사용하기  (0) 2011.03.10