한국어

네트워킹

온누리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
조회 수 :
36404
등록일 :
2017.08.30
19:35:50 (*.160.88.18)
엮인글 :
http://webs.co.kr/index.php?document_srl=3311471&act=trackback&key=f4a
게시글 주소 :
http://webs.co.kr/index.php?document_srl=3311471
List of Articles
번호 제목 글쓴이 날짜 조회 수
123 Tls ssl admin 2020-02-13 9699
122 Redis 소개와 설치 방법, 보안 설정 방법(ip 허용, 비밀번호 설정)등 빠르게 세팅하기 admin 2020-01-10 14690
121 debian Ubuntu 에서 Timezone 확인 및 변경하기 쉽게 간단하게 date time admin 2019-11-09 14359
120 Install Missing ifconfig Command on Debian ip address admin 2019-11-05 26285
119 데비안 vs 우분투 : 데스크탑과 서버로 비교 해외 글 과 댓글 admin 2019-10-31 25822
118 Debian vs Ubuntu: Compared as a Desktop and as a Server 데비안 vs 우분투 비교 admin 2019-10-31 15767
117 Error : unary operator expected – 쉘스크립트 타입관련 문법 admin 2019-09-14 22784
116 vi 에디터에서 ^M 문자 한번에 모두 지우기 ( ^M, ^L을 이해하자) admin 2019-06-20 14816
115 데비안 제시 jessie 소스리스트 sourcelist admin 2019-06-17 13658
114 File Descriptor (파일 디스크립터) 설명 무엇인가 사용방법 admin 2019-06-01 18221
113 Start / Stop and Restart Apache 2 Web Server Command 아파치 시작 스톱 명령어 admin 2019-04-08 36797
112 DebianPackageManagement admin 2019-04-08 11999
111 리눅스 우분투, 32비트 64비트 확인 명령어 admin 2019-01-06 16502
110 How to install a Debian 9 (Stretch) Minimal Server 데비안 9 설치 admin 2018-06-13 63391
109 Which is better, GCC or Clang? admin 2018-06-13 62803
108 고정ip설정, dns설정(데비안) linux 리눅스 admin 2018-06-13 19293
107 [리눅스] 부팅 시 자동 실행 프로그램 등록|작성자 나눔HN admin 2018-06-01 32482
106 리눅스 서버 유지보수 점검 메인터넌스 상황 파악 admin 2018-04-14 18297
105 Top 20 OpenSSH Server Best Security Practices 보안 대책 실제 적용 admin 2018-04-14 23252
104 Start Stop Restart Apache 2 Web Server Command Debian Ubuntu CentOS RHEL Fedora admin 2018-04-14 17747
103 리눅스 한글 2014 뷰어 다운로드 - hwpviewer admin 2018-03-28 19418
102 리눅스를 백업 복구 tar admin 2018-03-28 21608
101 zip 압축 파일 및 텍스트 파일의 한글 깨짐 해결 방법 admin 2018-03-28 29985
100 Lnux export how to admin 2017-12-17 23405
99 What's the difference between “adduser” and “useradd”? admin 2017-12-15 22122
98 useradd Command 리눅스 admin 2017-12-15 63306
97 How To Install Java with Apt-Get on Ubuntu 16.04 oracle java admin 2017-10-13 47125
96 우분투 Linux(Ubuntu)에 Java설치 및 환경 설정하는 방법 admin 2017-10-13 25374
95 우분투 다운로드 사이트 주소 ubuntu download 16.04.3 17.04 site link admin 2017-10-13 26022
94 How to install Java on linux with no Internet connectivity (using local repository) admin 2017-10-01 41985