한국어

네트워킹

온누리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
조회 수 :
36529
등록일 :
2017.08.30
19:35:50 (*.160.88.18)
엮인글 :
http://www.webs.co.kr/index.php?document_srl=3311471&act=trackback&key=b66
게시글 주소 :
http://www.webs.co.kr/index.php?document_srl=3311471
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
93 Debian Download 데비안 리눅스 다운로드 admin 2017-09-02 26755
92 특정 IP 엑세스 못하게 하는방법 admin 2014-10-29 26805
91 Configuration of Red Hat 5.4 Xen for SR-IOV Support admin 2015-08-02 28378
90 /bin/false, /sbin/nologin 의 차이점 admin 2014-10-13 28465
89 Linux and Unix touch command admin 2015-11-15 28789
88 다양한 사운드 파일있는곳 admin 2011-12-19 29890
87 Wireshark admin 2011-12-16 30035
86 zip 압축 파일 및 텍스트 파일의 한글 깨짐 해결 방법 admin 2018-03-28 30138
85 무료백신 여러가지 분류해놓은곳 admin 2011-12-16 30324
84 Event IP 20187 admin 2013-04-08 30391
83 Install GUI on Ubuntu Server admin 2014-12-21 30438
82 VMWARE VM Error boot loader install grub - install /dev/sda or /dev/hda MBR linux admin 2016-01-27 30659
81 debian 8.8 download cd1 cd2 cd3 etc admin 2017-09-03 30743
80 [리눅스] 소프트웨어 레이드의 리빌딩 및 리싱킹 속도를 높이는 5가지 방법 admin 2014-10-17 30957
79 Name Server 설정및 이해 admin 2011-12-13 31399
78 Remote Desktop Connection from Windows 7/8 to Ubuntu 14.04 admin 2014-12-21 31401
77 리눅스의 막강한 네트워크 필터 iptables admin 2012-04-15 31463
76 윈도우 ssh 접속 프로그램 admin 2017-09-29 31511
75 리눅스 시스템 유저 추가 명령어 useradd 사용하기 admin 2014-08-09 32387
74 [리눅스] 부팅 시 자동 실행 프로그램 등록|작성자 나눔HN admin 2018-06-01 32634
73 Linux Memory Management – Virtual Memory and Demand Paging admin 2014-03-03 32860
72 검색 파일리스트 만든 다음 여러파일 한방에 압축하기 admin 2012-02-14 32982
71 문서 편집기 vi vim command 명령어 정리 admin 2014-10-29 34118
70 Using Windows RDP to Access your Ubuntu Instance admin 2014-12-21 34888
69 Cloned VMware CentOS6 Server "device eth0 does not seem to be present, admin 2017-08-29 36055
68 WinXP 부팅안되는 현상 NTLDR is missing 메세지 admin 2012-07-12 36298
» 리눅스 시작시 부팅 시, 프로그램 자동실행 등록하기 admin 2017-08-30 36529
66 How to start GUI from command line? admin 2014-12-21 36852
65 Start / Stop and Restart Apache 2 Web Server Command 아파치 시작 스톱 명령어 admin 2019-04-08 36931
64 Deploying FreeRADIUS with the MySQL Cluster Database file admin 2013-03-22 37049