# 시간 동기화 스크립

**URL:** <https://discourse.ubuntu-kr.org/t/topic/301>\
**Category:** 자유 게시판\
**Tags:** 팁\_공유\
**Created:** [5월 2, 2008, 2:18오전 UTC](https://discourse.ubuntu-kr.org/t/topic/301 "2008-05-02T02:18:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user1](https://discourse.ubuntu-kr.org/letter_avatar_proxy/v4/letter/u/5daacb/32.png) [@user1](https://discourse.ubuntu-kr.org/u/user1)\
**Post date:** [5월 2, 2008, 2:18오전 UTC](https://discourse.ubuntu-kr.org/t/topic/301/1 "2008-05-02T02:18:53Z")

</div>

rdate 보다 강력 합니다. ^.^ 데탑 보단 서버에서 유용할듯 합니다.  
ntpdate 설치 필요  
$sudo apt-get install ntpdate

$vi /usr/local/bin/rtime

[code:1crama9d]#!/bin/bash  
date  
old\_time=`date +%Y%m%d%H%M%S`  
old\_time\_for\_insert=`date '+%Y-%m-%d %H&#58;%M&#58;%S'`  
ntpdate -b time.nuri.net  
#time.bora.net  
set\_time\_first=`date +%Y%m%d%H%M%S`  
if [$set\_time\_first -lt $old\_time]; then  
ntpdate -b time.kriss.re.kr  
fi  
set\_time\_second=`date +%Y%m%d%H%M%S`  
if [$set\_time\_first -lt $old\_time]; then  
ntpdate -b "$old\_time\_for\_insert" #  
fi  
date  
[/code:1crama9d]
