한국어

네트워킹

온누리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
조회 수 :
36575
등록일 :
2017.08.30
19:35:50 (*.160.88.18)
엮인글 :
http://webs.co.kr/index.php?document_srl=3311471&act=trackback&key=9d1
게시글 주소 :
http://webs.co.kr/index.php?document_srl=3311471
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
123 Tls ssl admin 2020-02-13 9897
122 DebianPackageManagement admin 2019-04-08 12192
121 데비안 제시 jessie 소스리스트 sourcelist admin 2019-06-17 13841
120 debian Ubuntu 에서 Timezone 확인 및 변경하기 쉽게 간단하게 date time admin 2019-11-09 14576
119 Redis 소개와 설치 방법, 보안 설정 방법(ip 허용, 비밀번호 설정)등 빠르게 세팅하기 admin 2020-01-10 14885
118 vi 에디터에서 ^M 문자 한번에 모두 지우기 ( ^M, ^L을 이해하자) admin 2019-06-20 15003
117 Debian vs Ubuntu: Compared as a Desktop and as a Server 데비안 vs 우분투 비교 admin 2019-10-31 15953
116 리눅스 우분투, 32비트 64비트 확인 명령어 admin 2019-01-06 16703
115 Start Stop Restart Apache 2 Web Server Command Debian Ubuntu CentOS RHEL Fedora admin 2018-04-14 17926
114 File Descriptor (파일 디스크립터) 설명 무엇인가 사용방법 admin 2019-06-01 18425
113 리눅스 서버 유지보수 점검 메인터넌스 상황 파악 admin 2018-04-14 18492
112 고정ip설정, dns설정(데비안) linux 리눅스 admin 2018-06-13 19486
111 리눅스 한글 2014 뷰어 다운로드 - hwpviewer admin 2018-03-28 19609
110 리눅스를 백업 복구 tar admin 2018-03-28 21788
109 linux debian 계열 network 설정 테트워크 데비안 admin 2017-09-07 22102
108 What's the difference between “adduser” and “useradd”? admin 2017-12-15 22305
107 데비안 리눅스 부팅시에 방화벽 서버에 자동실행 되게 설정 해보자 admin 2017-08-30 22483
106 Error : unary operator expected – 쉘스크립트 타입관련 문법 admin 2019-09-14 23012
105 openssl 을 이용한 인증서 생성 절차를 정리한다. 개인키 CSR SSL 인증서 파일 생성 admin 2017-09-14 23214
104 Top 20 OpenSSH Server Best Security Practices 보안 대책 실제 적용 admin 2018-04-14 23459
103 Lnux export how to admin 2017-12-17 23592
102 find 명령 사용 예제들 admin 2014-10-29 24353
101 SSH 무작위 로그인 시도 막기(With Fail2Ban on CentOS 6/7 + selinux) admin 2017-09-12 24360
100 sources.list lenny admin 2015-02-03 24367
99 Download all files in a directory using WGET admin 2014-12-16 24733
98 mount -t auto /dev/sdb1 /mnt && ls /mnt admin 2015-06-27 25568
97 우분투 Linux(Ubuntu)에 Java설치 및 환경 설정하는 방법 admin 2017-10-13 25574
96 데비안 vs 우분투 : 데스크탑과 서버로 비교 해외 글 과 댓글 admin 2019-10-31 26035
95 우분투 다운로드 사이트 주소 ubuntu download 16.04.3 17.04 site link admin 2017-10-13 26221
94 Install Missing ifconfig Command on Debian ip address admin 2019-11-05 26474