한국어

네트워킹

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


http://www.rasplay.org/?p=4854


매번 vncserver 명령어를 입력하지 않고, 부팅과 함께 자동으로 vncserver 가 실행될 수 있도록 라즈베리파이에 자동실행등록 법을 정리 해 봤습니다. 

 

 0. 라즈비안(리눅스) 프로그램 자동등록 실행 이란 ?

라즈비안(리눅스)에는 부팅 시, 자동등록 설정을 해주는 설정파일 등록방법과 명령어를 이용해 등록을 하는 두 가지가 존재하고 있다. 

a. /etc/rc.local 환경설정 수정

위 파일 내에 실행 명령어를 추가하여 부팅 시에 실행이 될 수 있도록 설정하는 방법

b. update-rc.d 명령어

별도의 등록 스크립트를 코딩하여, 부팅 시에 등록된 프로그램이 실행 될 수 있도록 설정하는 방법

1. /etc/rc.local 환경설정 수정 등록하기

  그럼 예시로 라즈비안 Remote 프로그램 중 하나인 tightvncserver 를 /etc/rc.local 파일 내에 등록하여, 자동실행이 되도록 해 보자.

pi@rasplay ~ $ sudo  nano /etc/rc.local

  편집기(nano,vi,vim ETC… ) 프로그램을 이용하여, ‘rc.local’ 환경설정 파일을 열면 아래와 같은 내용이 보일 것이다 이 중 추가해 주어야 하는 라인은 ‘fi’ 와 ‘exit 0’ 사이에 본인이 실행하고자 하는 프로그램 실행 명령어를 입력 후, 저장을 하고 재 부팅을 시동하여 테스트를 해 보자.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “My IP address is %sn” “$_IP”
fi
# ADD line :
su pi -c ‘tightvncserver :1’ &
exit 0

 

pi@rasplay ~ $ sudo  reboot

 

이제 모든 자동등록 절차가 마무리 되었으니, 라즈베리파이를 재 부팅해 정상 작동이 되었는지 확인을 해 보도록 하자.

2. update-rc.d 명령어로 등록하기

 

2-1. /etc/init.d/tightvnc script 작성

 

두번째로 update-rc.c 명령어를 이용해 스크립트를 코드하여 실행하는 방법에 대해 알아보자. 

pi@rasplay ~ $ sudo nano /etc/init.d/tightvnc
#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
 
# More details see: 
# http://www.penguintutor.com/linux/tightvnc
 
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER=’pi’
### End customization required
 
eval cd ~$USER
 
case “$1” in
  start)
    su $USER -c ‘/usr/bin/tightvncserver :1’
    echo “Starting TightVNC server for $USER “
    ;;
  stop)
    pkill Xtightvnc
    echo “Tightvncserver stopped”
    ;;
  *)
    echo “Usage: /etc/init.d/tightvncserver {start|stop}”
    exit 1
    ;;
esac
exit 0
 위 스크립트 코드를 /etc/init.d/tightvnc 파일 내에 작성 및 저장 후 빠져나 오도록 하자
 

2-2. /etc/init.d/tightvnc script 실행등록

 자 그럼 마지막으로 작성된 스크립드를 update-rc.d 명령어를 이용하여 부팅 시 자동실행이 되도록 등록 후 재부팅을 하여 정상적으로 등록 실행되고 있는지 확인 해 보도록 하자

 

pi@rasplay ~ $ sudo chown pi:pi /etc/init.d/tightvncserver
pi@rasplay ~ $ sudo chmod 755 /etc/init.d/tightvnc
pi@rasplay ~ $ sudo update-rc.d /etc/init.d/tightvnc defaults
pi@rasplay ~ $ sudo reboot

#Tip. update-rc.d 서비스 수동실행 명령어

$ sudo /etc/init.d/tightvnc start
$ sudo /etc/init.d/tightvnc stop
조회 수 :
36185
등록일 :
2017.08.30
19:35:50 (*.160.88.18)
엮인글 :
http://webs.co.kr/index.php?document_srl=3311471&act=trackback&key=ce0
게시글 주소 :
http://webs.co.kr/index.php?document_srl=3311471
List of Articles
번호 제목 글쓴이 날짜 조회 수
93 윈도우 ssh 접속 프로그램 admin 2017-09-29 31165
92 openvpn Easy Windows Guide admin 2017-09-20 119052
91 OpenVPN - Getting started How-To admin 2017-09-20 66078
90 openssl 을 이용한 인증서 생성 절차를 정리한다. 개인키 CSR SSL 인증서 파일 생성 admin 2017-09-14 22832
89 How to Manually Unblock / Unban IP Address in fail2ban 차단풀기 admin 2017-09-12 148699
88 How To Protect SSH with fail2ban on Debian 7 데비안 ssh 방어 무작위 로그인 admin 2017-09-12 118973
87 SSH 무작위 로그인 시도 막기(With Fail2Ban on CentOS 6/7 + selinux) admin 2017-09-12 23972
86 리눅스 데비안 네트워크 설정 유선랜 무선랜 linux debian network setting 설정 admin 2017-09-07 115378
85 linux debian 계열 network 설정 테트워크 데비안 admin 2017-09-07 21533
84 PUTTY DOWNLOAD - FREE SSH & TELNET CLIENT admin 2017-09-03 173386
83 debian 8.8 download cd1 cd2 cd3 etc admin 2017-09-03 30348
82 Debian Download 데비안 리눅스 다운로드 admin 2017-09-02 26445
81 데비안 리눅스 부팅시에 방화벽 서버에 자동실행 되게 설정 해보자 admin 2017-08-30 22067
80 리눅스 시작시에 부팅시 프로세스 프로그램 자동 실행 설정 admin 2017-08-30 116653
» 리눅스 시작시 부팅 시, 프로그램 자동실행 등록하기 admin 2017-08-30 36185
78 리눅스 부팅시 시작시 프로그램 명령어 실행하기 (Linux Init script) admin 2017-08-30 71800
77 리눅스 부팅시 자동 실행 명령스크립트 실행하기 만들기 이해 linux booting admin 2017-08-30 126541
76 부팅시 자동실행 명령어 스크립트, rc.local admin 2017-08-30 88514
75 the world’s most widely deployed RADIUS server document admin 2017-08-29 116522
74 네트워크 디바이스명 변경 리눅스 eth0 eth1 admin 2017-08-29 92685
73 Cloned VMware CentOS6 Server "device eth0 does not seem to be present, admin 2017-08-29 35538
72 VMWARE VM Error boot loader install grub - install /dev/sda or /dev/hda MBR linux admin 2016-01-27 30274
71 Linux and Unix touch command admin 2015-11-15 28443
70 Configuration of Red Hat 5.4 Xen for SR-IOV Support admin 2015-08-02 28013
69 apt-get install linux-image-2.6.26-2-686-bigmem admin 2015-06-27 46516
68 intel i210 driver install and compile debian admin 2015-06-27 265236
67 Debian / Ubuntu Linux Install Kernel Headers Package admin 2015-06-27 118413
66 mount -t auto /dev/sdb1 /mnt && ls /mnt admin 2015-06-27 25119
65 kali linux 해킹 hacking attack DDOS etc tools admin 2015-06-24 41197
64 sources.list lenny admin 2015-02-03 23916