Removed messy multi-lingual documents. Revised the URL and fixed typos.

This commit is contained in:
依瑪貓 2021-02-07 00:50:01 +08:00
parent dc0efb8611
commit 3fcb2c5c96
26 changed files with 145 additions and 790 deletions

View File

@ -1 +0,0 @@
依玛猫 <imacat@mail.imacat.idv.tw>

View File

@ -1 +0,0 @@
依瑪貓 <imacat@mail.imacat.idv.tw>

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -1,6 +1,23 @@
vsntp change log
2013-11-13
2020-02-07
1. .gitignore Added that excludes generated files by automake and
autoconf.
2. .git: Re-initialized.
3. AUTHORS.zh-tw, INSTALL.zh-tw, NEWS.zh-tw, README.zh-tw, THANKS.zh-tw,
init.d/README.zh-tw, AUTHORS.zh-cn, INSTALL.zh-cn, NEWS.zh-cn,
README.zh-cn, THANKS.zh-cn, init.d/README.zh-cn: Removed messy
multi-lingual documents.
4. README, ChangeLog, doc/vsntp.8, doc/vsntp.texi, init.d/vsntp.debian,
init.d/vsntp.redhat: Revised the URL and typos.
5. NEWS, init.d/README: Fixed typos.
6. vsntp.c, Makefile.am, doc/Makefile.am, init.d/Makefile.am, COPYING:
Updated the URL.
2020-02-01
vsntp is hosted on GitHub now.
2013-11-13 version 2.1.0 (not released)
Does not work on x86_64 yet. Don't know whether it still works on i386.
I don't have i386 anymore.
1. vsntp.c: Removed the weird method to calculate the next time line
@ -10,10 +27,10 @@ vsntp change log
will overload the server and create DDoS. Thanks to the reminder of
Steven Shen <fbishen@gmail.com>.
2. AUTHORS.zh-tw, INSTALL.zh-tw, NEWS.zh-tw, README.zh-tw, THANKS.zh-tw,
init.d/README.zh-tw: Converted from Big5 to UTF-8. I'm not woking
init.d/README.zh-tw: Converted from Big5 to UTF-8. I'm not working
on Windows anymore. Big5 cause problem with gedit.
3. AUTHORS.zh-cn, INSTALL.zh-cn, NEWS.zh-cn, README.zh-cn, THANKS.zh-cn,
init.d/README.zh-cn: Converted from GB2312 to UTF-8. I'm not woking
init.d/README.zh-cn: Converted from GB2312 to UTF-8. I'm not working
on Windows anymore. GB2312 cause problem with gedit.
4. configure: Updated with GNU Autoconf 2.69.
@ -24,17 +41,17 @@ vsntp change log
4. Removed Traditional Chinese comments.
2004-03-29 version 2.0.0
1. vsntp.c: The syhchronization scheduler has been rewritten to
1. vsntp.c: The synchronization scheduler has been rewritten to
allow alternative schedulers, in order to work with the problem
reported by Jean-Alain Le Borgne <jalb@pobox.com> 2007-03-26,
that sleep() may not return after MS Virtual PC 2007 was suspended
for a while.
2. vsntp.c: An alternative schedular using alarm() was added in
2. vsntp.c: An alternative scheduler using alarm() was added in
addition to sleep(), based on the contribution by Jean-Alain.
3. vsntp.c: New subroutine setsigalrm() was added to set the SIGALRM
signal handler.
4. vsntp.c: New subroutine alarm_wakeup() was added as the alarm()
schedular.
scheduler.
5. vsntp.c: Two new constants SCHEDULER_SLEEP and SCHEDULER_ALARM were
added as the scheduler choices of the user.
6. vsntp.c: Two new switches -a/--alarm and -s/--sleep were added for
@ -53,7 +70,7 @@ vsntp change log
12. vsntp.c: Re-formatting error messages and warnings according to
the GNU Coding Standards, as:
source-file-name:lineno: message
Refer to: http://www.gnu.org/prep/standards/html_node/Errors.html
Refer to: https://www.gnu.org/prep/standards/html_node/Errors.html
13. vsntp.c: Added logging before connect(), send() and recv() at
log level LOG_DEBUG in order to know the current progress when
debugging network problems.
@ -68,9 +85,9 @@ vsntp change log
17. vsntp.c: English comment fix. "... and handle errors" was updated
as "... and handle its error."
18. configure.ac: Added AC_TYPE_SSIZE_T, and added "alarm()" in
AC_CHECK_FUNCS, acccording to the suggestion by automake 1.9.6.
19. configure.in and aclocal.m4: Regenrated using automake 1.9.6.
20. configure: Regenrated using autoconf 2.61.
AC_CHECK_FUNCS, according to the suggestion by automake 1.9.6.
19. configure.in and aclocal.m4: Regenerated using automake 1.9.6.
20. configure: Regenerated using autoconf 2.61.
21. vsntp.c: Added conditional #ifdef, so that if alarm() is not
supported on the target platform the alarm() scheduler will not
be compiled.
@ -84,7 +101,7 @@ vsntp change log
25. vsntp.c: Fixed the basic profile in the beginning comment, from
synctime.c to vsntp.c. That was the first name of vsntp. It was
renamed for years.
26. vsntp.8: Fixed the BUGS chapter, replacing the originall text with
26. vsntp.8: Fixed the BUGS chapter, replacing the original text with
the SourceForge users' mailing list information.
27. README, vsntp.8 and vsntp.texi: Added notes about the scheduler
issue.

View File

@ -1,81 +0,0 @@
vsntp 安装执行说明
一、编译安装程序
vsntp 使用标准的 GNU autoconf 来安装编译:
1. 下载 vsntp 并解压缩:
% tar xzf vsntp-x.x.x.tar.gz
2. 进入 vsntp 的子目录:
% cd vsntp-x.x.x
3. 执行 ./configure 设定:
% ./configure
4. 以 make 编译:
% make
编译出来的档案为 vsntp 。
5. 要安装程式,你可能要先 su 到 root ,用 root 的权限安装:
% su
Password:
#
6. 将 vsntp 档复制到适当的目录即可:
# cp vsntp /usr/local/sbin
或者,你也可以用自动安装:
# make install
或用 install-strip 清除档案里的除错符号,安装起来档案比较小:
# make install-strip
用上述方式安装时, vsntp 预设安装目录在 /usr/local/sbin 。
二、编译安装选项
GNU autoconf 的 configure 提供下列的编译安装选项:
--prefix=PREFIX 作业平台无关的档案装在 PREFIX 下 [/usr/local]
--exec-prefix=EPREFIX 作业平台专用的档案装在 EPREFIX 下 [PREFIX]
--bindir=DIR 一般使用者用的执行档 [EPREFIX/bin]
--sbindir=DIR 系统管理者用的执行档 [EPREFIX/sbin]
--libexecdir=DIR 程式内部引用的执行档 [EPREFIX/libexec]
--datadir=DIR 与作业平台无关的唯读资料 [PREFIX/share]
--sysconfdir=DIR 本系统专用的唯读资料 [PREFIX/etc]
--sharedstatedir=DIR 与作业平台无关的异动资料 [PREFIX/com]
--localstatedir=DIR 本系统专用的异动资料 [PREFIX/var]
--libdir=DIR 目的码程式库 [EPREFIX/lib]
--includedir=DIR C 语言标头档 [PREFIX/include]
--oldincludedir=DIR 非 gcc 用的 C 语言标头档 [/usr/include]
--infodir=DIR info 说明文件 [PREFIX/info]
--mandir=DIR man 说明文件 [PREFIX/man]
完整的编译安装选项,请参阅 ./configure --help 的说明。
三、执行
要有 root 权限才能执行 vsntp 。 vsntp 用 settimeofday() 对时,没
有 root 权限不能执行 settimeofday() 。
要启动 vsntp ,加上对时用的 ntp server 即可:
# vsntp my.ntp.server.com
vsntp 会把 PID 存在 /var/run/vsntp.pid 。要结束程式,只要 kill 它
的 PID 即可:
# kill `cat /var/run/vsntp.pid`
你可以用 -p 选项,更改 PID 档的位置。

View File

@ -1,81 +0,0 @@
vsntp 安裝執行說明
一、編譯安裝程序
vsntp 使用標準的 GNU autoconf 法編譯安裝:
1. 下載 vsntp 並解壓縮:
% tar xzf vsntp-x.x.x.tar.gz
2. 進入 vsntp 的子目錄:
% cd vsntp-x.x.x
3. 執行 ./configure 設定:
% ./configure
4. 以 make 編譯:
% make
編譯出來的檔案為 vsntp 。
5. 要安裝程式,妳可能要先 su 到 root ,用 root 的權限安裝:
% su
Password:
#
6. 將 vsntp 檔複製到適當的目錄即可:
# cp vsntp /usr/local/sbin
或者,妳也可以用自動安裝:
# make install
妳也可以邊裝邊清掉檔案裏的除錯符號,安裝起來檔案比較小:
# make install-strip
用上述方式安裝時, vsntp 預設安裝目錄在 /usr/local/sbin 。
二、編譯安裝選項
GNU autoconf 的 configure 提供下列的編譯安裝選項:
--prefix=PREFIX 作業平台無關的檔案裝在 PREFIX 下 [/usr/local]
--exec-prefix=EPREFIX 作業平台專用的檔案裝在 EPREFIX 下 [PREFIX]
--bindir=DIR 一般使用者用的執行檔 [EPREFIX/bin]
--sbindir=DIR 系統管理者用的執行檔 [EPREFIX/sbin]
--libexecdir=DIR 程式內部引用的執行檔 [EPREFIX/libexec]
--datadir=DIR 與作業平台無關的唯讀資料 [PREFIX/share]
--sysconfdir=DIR 本系統專用的唯讀資料 [PREFIX/etc]
--sharedstatedir=DIR 與作業平台無關的異動資料 [PREFIX/com]
--localstatedir=DIR 本系統專用的異動資料 [PREFIX/var]
--libdir=DIR 目的碼程式庫 [EPREFIX/lib]
--includedir=DIR C 語言標頭檔 [PREFIX/include]
--oldincludedir=DIR 非 gcc 用的 C 語言標頭檔 [/usr/include]
--infodir=DIR info 說明文件 [PREFIX/info]
--mandir=DIR man 說明文件 [PREFIX/man]
完整的編譯安裝選項,請參閱 ./configure --help 的說明。
三、執行
要有 root 權限才能執行 vsntp 。 vsntp 用 settimeofday() 對時,沒
有 root 權限不能執行 settimeofday() 。
要啟動 vsntp ,加上對時用的 NTP server 即可:
# vsntp my.ntp.server.com
vsntp 會把 PID 存在 /var/run/vsntp.pid 。要結束程式,只要 kill 它
的 PID 即可:
# kill `cat /var/run/vsntp.pid`
妳可以用 -p 選項,更改 PID 檔的位置。

View File

@ -14,12 +14,11 @@
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## along with this program. If not, see <https://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = gnits
sbin_PROGRAMS = vsntp
vsntp_SOURCES = vsntp.c
EXTRA_DIST = README.* INSTALL.* NEWS.* AUTHORS.* THANKS.*
SUBDIRS = doc init.d

22
NEWS
View File

@ -1,5 +1,25 @@
vsntp NEWS
2021-02-07
1. AUTHORS.zh-tw, INSTALL.zh-tw, NEWS.zh-tw, README.zh-tw, THANKS.zh-tw,
init.d/README.zh-tw, AUTHORS.zh-cn, INSTALL.zh-cn, NEWS.zh-cn,
README.zh-cn, THANKS.zh-cn, init.d/README.zh-cn: Removed messy
multi-lingual documents.
2. README: Revised the URL and typos.
2013-11-13 version 2.1.0 (not released)
1. vsntp.c: Removed the weird method to calculate the next time line
for synchronization. It was my bad taste to synchronize at the
the time of multiples of interval. When many clients are
synchronized to a same server, synchronizing them at a same time
will overload the server and create DDoS. Thanks to the reminder of
Steven Shen <fbishen@gmail.com>.
2. AUTHORS.zh-tw, INSTALL.zh-tw, NEWS.zh-tw, README.zh-tw, THANKS.zh-tw,
init.d/README.zh-tw, AUTHORS.zh-cn, INSTALL.zh-cn, NEWS.zh-cn,
README.zh-cn, THANKS.zh-cn, init.d/README.zh-cn: Converted from Big5
and GB2312 to UTF-8.
3. License updated to GPLv3.
2007-03-29 version 2.0.0
1. Added alarm() in addition to sleep() as an alternative
synchronization scheduler, in order to fix a problem that vsntp
@ -7,7 +27,7 @@ vsntp NEWS
for a while, as reported and suggested by Jean-Alain Le Borgne
<jalb@pobox.com> 2007-03-26. The codes are based on
Jean-Alain's contribution. Thank you. Two new switches "-a" and
"-s" were added for for setting the schedular. Currently the
"-s" were added for for setting the scheduler. Currently the
default is -s (sleep()). If you find vsntp stops synchronization
after running for some time, that the sleep() is not functioning
normally on your system, you may try to switch to alarm() using

View File

@ -1,25 +0,0 @@
vsntp 新版功能:
2007-03-29 2.0.0 版
1. 加上 alarm() ,作为 sleep() 之外的另一种计时器,以解决
Jean-Alain Le Borgne <jalb@pobox.com> 於 2007-03-26 所回报与建议
的, MS Virtual PC 2007 在暂停一段时间后复原, sleep() 定时会醒不
来的问题。程式由 Jean-Alain 贡献的修正码改写而成,在此致谢。新增两
个选项 -a 与 -s ,以设定要用的计时器。目前预设为 -s ,使用 sleep()
呼叫定时。若你 vsntp 校时一段时间后就不动了,系统的 sleep() 呼叫有
问题时,可以加上 -a 选项,改用 alarm() 定时。
2. 加上更多侦错的 syslog 记录讯息,大多记录於 LOG_DEBUG 层级。
3. 在 init.d 目录下,提供两个 SysV 的启动程式,以便大家使用。请查阅
init.d 目录下 README 档案的说明。
2004-01-14 1.1.1 版
修订说明文件。
1. 修订参考资料。
2004-01-12 1.1.0 版
正式公开发行。
1. 加上 -i 与 -p 选项。
2. 加上说明文件。
2003-12-24 1.0.0 版
第一版。

View File

@ -1,25 +0,0 @@
vsntp 新版功能:
2007-03-29 2.0.0 版
1. 加上 alarm() ,作為 sleep() 之外的另一種計時器,以解決
Jean-Alain Le Borgne <jalb@pobox.com> 於 2007-03-26 所回報與建議
的, MS Virtual PC 2007 在暫停一段時間後復原, sleep() 定時會醒不
來的問題。程式由 Jean-Alain 貢獻的修正碼改寫而成,在此致謝。新增兩
個選項 -a 與 -s ,以設定要用的計時器。目前預設為 -s ,使用 sleep()
呼叫定時。若妳 vsntp 校時一段時間後就不動了,系統的 sleep() 呼叫有
問題時,可以加上 -a 選項,改用 alarm() 定時。
2. 加上更多偵錯的 syslog 記錄訊息,大多記錄於 LOG_DEBUG 層級。
3. 在 init.d 目錄下,提供兩個 SysV 的啟動程式,以便大家使用。詳情請查
閱 init.d 目錄下 README 檔案的說明。
2004-01-14 1.1.1 版
修訂說明文件。
1. 修訂參考資料。
2004-01-12 1.1.0 版
正式公開發行。
1. 加上 -i 與 -p 選項。
2. 加上說明文件。
2003-12-24 1.0.0 版
第一版。

18
README
View File

@ -6,19 +6,17 @@ Obtaining the Newest Information
vsntp's official website is at...
SourceForge's home site: http://vsntp.sourceforge.net/
SourceForge's project page: https://sourceforge.net/projects/vsntp/
Tavern IMACAT's page: http://www.imacat.idv.tw/tech/vsntp.html
vsntp project on GitHub: https://github.com/imacat/vsntp
vsntp project on SourceForge: https://sf.net/p/vsntp
You can always download the newest version of vsntp from...
SourceForge: https://sourceforge.net/project/showfiles.php?group_id=99098
Tavern IMACAT's FTP: ftp://ftp.imacat.idv.tw/pub/vsntp/
vsntp download on SourceForge: https://sourceforge.net/projects/vsntp/files
Tavern IMACAT's FTP directory: https://ftp.imacat.idv.tw/pub/vsntp/
imacat's PGP public key is at...
SourceForge: http://vsntp.sourceforge.net/pgpkey.asc
Tavern IMACAT's: http://www.imacat.idv.tw/me/pgpkey.asc
Tavern IMACAT's: https://www.imacat.idv.tw/me/pgpkey.asc
Introduction:
@ -37,7 +35,7 @@ With smooth run it goes 4 seconds ahead per minute, which is nearly
eyes.
David L. Mills' ntp does not work here. It uses a method that
learns the clock frequency drift first, and adjust the kerenl clock
learns the clock frequency drift first, and adjust the kernel clock
with adjtimex() so that time adjustment goes smoothly, from the point
of view of system and applications. This assumes an existing fix-
speed system clock. But this is not the case of Virtual PC. The
@ -80,8 +78,8 @@ LOG_DEBUG with facility LOG_DAEMON. You may turn it on in your
and check the /var/log/debug file for the debugging message. Remember
to remove this afterwards, for the amount of the debugging messages
may be huge and may use up your harddisk in a very short time. To the
least it may slow down your system for frequent harddisk I/O.
may be huge and may use up your hard disk in a very short time. To the
least it may slow down your system for frequent hard disk I/O.
vsntp was originally written for GNU/Linux. It uses POSIX
compatible system calls. It should work on any POSIX compatible

View File

@ -1,82 +0,0 @@
vsntp 读我说明
请参阅 INSTALL 档案,以取得安装执行的相关说明。
想知道 vsntp 的最新消息,下载最新版本,请参阅:
http://vsntp.sourceforge.net/
http://sourceforge.net/projects/vsntp
http://www.imacat.idv.tw/tech/vsntp.html
ftp://ftp.imacat.idv.tw/pub/vsntp/
作者的 PGP Public Key 可在下列网址下载:
http://www.imacat.idv.tw/me/pgpkey.txt
简介:
vsntp 是 SNTP 客户端服务程式,专为时间不正常的系统设计。 vsntp
的意思是 SNTP for Virtual PC ,原先是我为了在 Connectix Virtual PC
上跑 GNU/Linux 系统而写。 vsntp 依 RFC 1769 SNTP 标准,连线到 SNTP 伺
服器上的 UDP 埠 123 以校时。
若没有装 Virtual PC Additions Virtual PC 的时间很乱。 Virtual
PC 的 RTC Real Time Clock, 或称 CMOS 时钟、硬体时钟)是用软体模拟
出来的,往往根本没有在跑。 GNU/Linux 核心勉强维持一个大概的时间。正常
情况下,平均一分钟会快四秒,一天快一个半小时。这实在是太夸张了,用眼
睛都分辨得出时钟速度有问题。
David L. Mills 的 ntp 校时伺服器在此完全失灵。 ntp 先测出系统时间
速度偏移,用 adjtimex() 来调整系统时钟速度,用这个方法渐近式调整,系
统本身和相关应用程式比较不会出问题。这个方法有一个前提:时间速度本身
恒定不变。可是 Virtual PC 不讲这一套。 Virtual PC 的时间纯粹是软体模
拟出来的,受主电脑负荷与其它因素影响,时快时慢。没有固定的时间速度,
也就没有时间速度偏移值。怎么测都是枉然。
David L. Mills 的 ntp 程式里,附了一 sntp 客户端程式,可以放在
crontab 里定期对时,对时完结束程式。问题是, crontab 最小单位为分,
顶多一分钟跑一次,可是 Virtual PC 的时间一分钟慢四秒。一分钟退回四秒
,大多数应用程式都受不了。一分钟跑一次,对系统的负荷也很大。
vsntp 是为此而写的。它以 daemon 来执行,以免每次对时都对系统造成
严重负荷。它用 settimeofday() 来调整时间,校时频率可任意设定,尽可能
把系统时钟误差,维持在一秒以内。
vsntp 的做法有下列缺陷:频繁校时时,网路流量很大,频宽的负荷不小
,对对方 NTP 伺服器也会造成很大的负担。你最好自己在区网内,架一台自
己的 NTP 伺服器。同时因 settimeofday() 强制时间设定太频繁了,系统的
高精度计时功能会出问题。
  vsntp 用 sleep() 呼叫来定时校时。在某些系统上 sleep() 可能不大正
常。若 vsntp 校时一段时间后就不动了,系统上的 sleep() 呼叫不正常时,
可以改用 -a 选项换成 alarm() 计时器试看看。
  若碰到任何问题,请参阅你系统的上的 syslog 记录。 vsntp 把详细侦错
讯息,都以 LOG_DEBUG 层次, LOG_DAEMON 类别记录到 syslog 中。你可以在
/etc/syslog.conf 中加上这一行,写入侦错讯息:
daemon.debug /var/log/debug
并查阅 /var/log/debug 中的侦错讯息。记得在侦错结束后关闭。侦错讯息流
量很大,很快就会塞爆硬碟。就算没塞爆,大量资料写入硬碟,对系统效能的
影响也很大。
   vsntp 原是为 GNU/Linux 系统上执行而写。 vsntp 用的都是 POSIX 相
容的系统呼叫,在 POSIX 相容系统上应该都可以执行。不过目前为止我只有
Cygwin ,只在 Cygwin 上测试过。 Cygwin 上可以执行。若你可以成功在其它
系统上执行,请来信告知。若需要任何原始程式的修正,亦请一并附给我。我
知道因为 PID 档路径处理方式,所以无法在 MSWin32 上执行。
  vsntp 只在 GNU/Linux 系统上测试执行过。 vsntp 用的都是 POSIX 相容
的系统呼叫,在 POSIX 相容系统上应该都可以执行。不过我没有其它系统,无
从测试起。若你可以成功在其它系统上执行,请来信告知。若需要任何原始程式
的修正,亦请一并附给我。我知道因为 PID 档路径处理方式,所以无法在
MSWin32 上执行。但在 Cygwin 上说不定可以执行。
  若你可以在其它虚拟机器上执行 vsntp ,例如 VMWare ,请来信告知。
  基本上,若你在用 vsntp ,请一定要来信告诉我。我很想知道 vsntp 是
不是真的有人在用,对世界和平有帮助 *^_^* 或只是自己写好玩的而已。 :p
vsntp 是我写的第一个 daemon ,我写的第一个 socket 程式,也是我第
一个公开发行的 C 程式。请多多指教~ ^_*'

View File

@ -1,82 +0,0 @@
vsntp 讀我說明
請參閱 INSTALL 檔案,以取得安裝執行的相關說明。
想知道 vsntp 的最新消息,下載最新版本,請參閱:
http://vsntp.sourceforge.net/
http://sourceforge.net/projects/vsntp
http://www.imacat.idv.tw/tech/vsntp.html
ftp://ftp.imacat.idv.tw/pub/vsntp/
作者的 PGP Public Key 可在下列網址下載:
http://www.imacat.idv.tw/me/pgpkey.txt
簡介:
vsntp 是 SNTP 客戶端服務程式,專為時間不正常的系統設計。 vsntp
的意思是 SNTP for Virtual PC ,原先是我為了在 Connectix Virtual PC
上跑 GNU/Linux 系統而寫。 vsntp 依 RFC 1769 SNTP 標準,連線到 SNTP 伺
服器上的 UDP 埠 123 以校時。
若沒有裝 Virtual PC Additions Virtual PC 的時間很亂。 Virtual
PC 的 RTC Real Time Clock, 或稱 CMOS 時鐘、硬體時鐘)是用軟體模擬
出來的,往往根本沒有在跑。 GNU/Linux 核心勉強維持一個大概的時間。正常
情況下,平均一分鐘會快四秒,一天快一個半小時。這實在是太誇張了,用眼
睛都分辨得出時鐘速度有問題。
David L. Mills 的 ntp 校時伺服器在此完全失靈。 ntp 先測出系統時間
速度偏移,用 adjtimex() 來調整系統時鐘速度,用這個方法漸近式調整,系
統本身和相關應用程式比較不會出問題。這個方法有一個前提:時間速度本身
恆定不變。可是 Virtual PC 不講這一套。 Virtual PC 的時間純粹是軟體模
擬出來的,受主電腦負荷與其它因素影響,時快時慢。沒有固定的時間速度,
也就沒有時間速度偏移值。怎麼測都是枉然。
David L. Mills 的 ntp 程式裏,附了一 sntp 客戶端程式,可以放在
crontab 裏定期對時,對時完結束程式。問題是, crontab 最小單位為分,
頂多一分鐘跑一次,可是 Virtual PC 的時間一分鐘慢四秒。一分鐘退回四秒
,大多數應用程式都受不了。一分鐘跑一次,對系統的負荷也很大。
vsntp 是為此而寫的。它以 daemon 來執行,以免每次對時都對系統造成
嚴重負荷。它用 settimeofday() 來調整時間,校時頻率可任意設定,儘可能
把系統時鐘誤差,維持在一秒以內。
vsntp 的做法有下列缺陷:頻繁校時時,網路流量很大,頻寬的負荷不小
,對對方 NTP 伺服器也會造成很大的負擔。妳最好自己在區網內,架一台自
己的 NTP 伺服器。同時因 settimeofday() 強制時間設定太頻繁了,系統的
高精度計時功能會出問題。
  vsntp 用 sleep() 呼叫來定時校時。在某些系統上 sleep() 可能不大正
常。若 vsntp 校時一段時間後就不動了,系統上的 sleep() 呼叫不正常時,
可以改用 -a 選項換成 alarm() 計時器試看看。
  若碰到任何問題,請參閱妳系統的上的 syslog 記錄。 vsntp 把詳細偵錯
訊息,都以 LOG_DEBUG 層次, LOG_DAEMON 類別記錄到 syslog 中。妳可以在
/etc/syslog.conf 中加上這一行,寫入偵錯訊息:
daemon.debug /var/log/debug
並查閱 /var/log/debug 中的偵錯訊息。記得在偵錯結束後關閉。偵錯訊息流
量很大,很快就會塞爆硬碟。就算沒塞爆,大量資料寫入硬碟,對系統效能的
影響也很大。
   vsntp 原是為 GNU/Linux 系統上執行而寫。 vsntp 用的都是 POSIX 相
容的系統呼叫,在 POSIX 相容系統上應該都可以執行。不過目前為止我只有
Cygwin ,只在 Cygwin 上測試過。 Cygwin 上可以執行。若妳可以成功在其它
系統上執行,請來信告知。若需要任何原始程式的修正,亦請一併附給我。我
知道因為 PID 檔路徑處理方式,所以無法在 MSWin32 上執行。
  vsntp 只在 GNU/Linux 系統上測試執行過。 vsntp 用的都是 POSIX 相容
的系統呼叫,在 POSIX 相容系統上應該都可以執行。不過我沒有其它系統,無
從測試起。若妳可以成功在其它系統上執行,請來信告知。若需要任何原始程式
的修正,亦請一併附給我。我知道因為 PID 檔路徑處理方式,所以無法在
MSWin32 上執行。但在 Cygwin 上說不定可以執行。
  若妳可以在其它虛擬機器上執行 vsntp ,例如 VMWare ,請來信告知。
  基本上,若妳在用 vsntp ,請一定要來信告訴我。我很想知道 vsntp 是
不是真的有人在用,對世界和平有幫助 *^_^* 或只是自己寫好玩的而已。 :p
vsntp 是我寫的第一個 daemon ,我寫的第一個 socket 程式,也是我第
一個公開發行的 C 程式。請多多指教~ ^_*'

View File

@ -1,5 +0,0 @@
感谢 SourceForge 热心提供架设 vsntp 。
感谢 Jean-Alain Le Borgne <jalb@pobox.com> 於 2007-03-26 侦错并找出
以 sleep() 定时,在 MS Virtual PC 2007 暂停一段时间后恢复,会醒不来的问题,
回报该问题,并提供 alarm() 作为替代的定时器的修正程式。

View File

@ -1,5 +0,0 @@
感謝 SourceForge 熱心提供架設 vsntp 。
感謝 Jean-Alain Le Borgne <jalb@pobox.com> 於 2007-03-26 偵錯並找出
以 sleep() 定時,在 MS Virtual PC 2007 暫停一段時間後恢復,會醒不來的問題,
回報該問題,並提供 alarm() 作為替代的定時器的修正程式。

View File

@ -1,122 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define as `fork' if `vfork' does not work. */
#undef vfork

View File

@ -14,7 +14,7 @@
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## along with this program. If not, see <https://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = gnits

View File

@ -46,7 +46,7 @@ That is insane. You can even tell it with your eyes.
David L. Mills'
.B ntp
does not work here. It uses a method that learns the clock frequency
drift first, and adjust the kerenl clock with
drift first, and adjust the kernel clock with
.B adjtimex()
so that time adjustment goes smoothly, from the point of view of
system and applications. This assumes an existing fix-speed system
@ -174,29 +174,14 @@ and check the
.I /var/log/debug
file for the debugging message. Remember to remove this afterwards,
for the amount of the debugging messages may be huge and may use up
your harddisk in a very short time. To the least it may slow down
your system for frequent harddisk
your hard disk in a very short time. To the least it may slow down
your system for frequent hard disk
.SM "I/O" .
.SH BUGS
The
.B vsntp
is hosted on SourceForge and Tavern IMACAT's. For the latest
infomation, see:
http://vsntp.sourceforge.net/
https://sourceforge.net/projects/vsntp/
http://www.imacat.idv.tw/tech/vsntp.html
.B vsntp has a mailing list hosted at SourceForge:
vsntp-users@lists.sourceforge.net . Please submit your questions,
suggestions or bug reports there. It is a Mailman mailing list.
For more information, see:
https://lists.sourceforge.net/lists/listinfo/vsntp-users
Alternatively, you can send a mail to:
vsntp-users-request@lists.sourceforge.net with the subject
.B help
for a list of available e-mail commands.
project is hosted on GitHub. Address your issues on the GitHub issue
tracker https://github.com/imacat/chklinks/issues.
.SH AUTHOR
imacat <imacat@mail.imacat.idv.tw>.
.SH "SEE ALSO"

View File

@ -12,7 +12,7 @@ This manual is for vsntp
(version @value{VERSION}, @value{UPDATED}),
a SNTP daemon for Virtual @acronym{PC}@.
Copyright @copyright{} 2003-2007 imacat@.
Copyright @copyright{} 2003-2021 imacat@.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ -33,7 +33,7 @@ Free Documentation License''@.
@insertcopying
Published by imacat@*
@email{imacat@@mail.imacat.idv.tw}@*
@uref{http://www.imacat.idv.tw/}@*
@uref{https://www.imacat.idv.tw/}@*
@end titlepage
@c Output the table of contents at the beginning.
@contents
@ -84,7 +84,7 @@ insane@. You can even tell it with your eyes@.
@findex adjtimex()
@uref{http://www.ntp.org/,David L. Mills' @command{ntp}} does not
work here@. It uses a method that learns the clock frequency drift
first, and adjust the kerenl clock with @code{adjtimex()} so that
first, and adjust the kernel clock with @code{adjtimex()} so that
time adjustment goes smoothly, from the point of view of system and
applications@. This assumes an existing fix-speed system clock@.
But this is not the case of Virtual @acronym{PC}@. The system clock
@ -135,9 +135,9 @@ daemon.debug /var/log/debug
and check the @file{/var/log/debug} file for the debugging message@.
Remember to remove this afterwards, for the amount of the debugging
messages may be huge and may use up your harddisk in a very short
messages may be huge and may use up your hard disk in a very short
time@. To the least it may slow down your system for frequent
harddisk @acronym{I/O}@.
hard disk @acronym{I/O}@.
@command{vsntp} was originally written for @acronym{GNU}/Linux@. It
uses @acronym{POSIX} compatible system calls@. It should work on
@ -149,7 +149,7 @@ other systems@. I know it does not work on MSWin32, for the way it
handles the @acronym{PID} file path@.
Please tell me if you have successfully running @command{vsntp} on
other virtual machines, like @uref{http://www.vmware.com/, VMWare}@.
other virtual machines, like @uref{https://www.vmware.com/, VMWare}@.
Generally, please tell me if you are using @command{vsntp}@. I
would like to know that I am really doing some good for the world,
@ -164,20 +164,14 @@ would like to know that I am really doing some good for the world,
@cindex download
@cindex SourceForge
@cindex Tavern IMACAT's
@command{vsntp}'s official website is at@dots{}
@command{vsntp} is hosted is on@dots{}
@itemize
@item
@uref{https://sourceforge.net/,SourceForge}'s home site:
@uref{http://vsntp.sourceforge.net/}
@uref{https://github.com/imacat/vsntp,vsntp project on GitHub}
@item
@uref{https://sourceforge.net/,SourceForge}'s project page:
@uref{https://sourceforge.net/projects/vsntp/}
@item
@uref{http://www.imacat.idv.tw/,Tavern IMACAT's} page:
@uref{http://www.imacat.idv.tw/tech/vsntp.html}
@uref{https://sf.net/p/vsntp,vsntp project on SourceForge}
@end itemize
You can always download the newest version of @command{vsntp}
@ -186,23 +180,17 @@ from@dots{}
@itemize
@item
SourceForge:
@uref{https://sourceforge.net/project/showfiles.php?group_id=99098}
@uref{https://sourceforge.net/projects/vsntp/files,vsntp download on SourceForge}
@item
Tavern IMACAT's @acronym{FTP}:
@uref{ftp://ftp.imacat.idv.tw/pub/vsntp/}
@uref{https://ftp.imacat.idv.tw/pub/chklinks/,Tavern IMACAT's FTP directory}
@end itemize
imacat's @acronym{PGP} public key is at@dots{}
@itemize
@item
SourceForge:
@uref{http://vsntp.sourceforge.net/pgpkey.asc}
@item
Tavern IMACAT's:
@uref{http://www.imacat.idv.tw/me/pgpkey.asc}
@uref{https://www.imacat.idv.tw/me/pgpkey.asc,imacats PGP key at Tavern IMACATs}
@end itemize
@ -330,34 +318,10 @@ Display version information@.
@cindex SourceForge
@cindex Tavern IMACAT's
@command{vsntp} is hosted on
@uref{https://sourceforge.net/,SourceForge} and
@uref{http://www.imacat.idv.tw/,Tavern IMACAT's}@. For the latest
infomation, see:
@itemize
@item
@uref{http://vsntp.sourceforge.net/}
@item
@uref{https://sourceforge.net/projects/vsntp/}
@item
@uref{http://www.imacat.idv.tw/tech/vsntp.html}
@end itemize
@cindex mailing list
@cindex Mailman
@command{vsntp} has a mailing list hosted at
@uref{https://sourceforge.net/,SourceForge}:
@email{vsntp-users@@lists.sourceforge.net}@. Please submit your
questions, suggestions or bug reports there@. It is a
@uref{http://www.list.org/,Mailman} mailing list@. For more
information, see:
@uref{https://lists.sourceforge.net/lists/listinfo/vsntp-users}@.
Alternatively, you can send a mail to:
@email{vsntp-users-request@@lists.sourceforge.net}
with the subject @code{help} for a list of available e-mail
commands@.
The @command{vsntp} project is hosted on GitHub. Address your issues on the
GitHub issue tracker
@uref{https://github.com/imacat/vsntp/issues}
.
@node References
@unnumbered References
@ -385,7 +349,7 @@ commands@.
@unnumbered Copyright
@quotation
Copyright @copyright{} 2003-2007 imacat@.
Copyright @copyright{} 2003-2021 imacat@.
This program is free software: you can redistribute it and/or modify
it under the terms of the @cite{@acronym{GNU} General Public License}
@ -399,7 +363,7 @@ See the @cite{@acronym{GNU} General Public License} for more details@.
You should have received a copy of the @cite{@acronym{GNU} General
Public License} along with this program@. If not, see
<@uref{http://www.gnu.org/licenses/}>@.
<@uref{https://www.gnu.org/licenses/}>@.
@end quotation
@node Index

View File

@ -14,7 +14,7 @@
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## along with this program. If not, see <https://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = gnits

View File

@ -14,7 +14,7 @@ systems (Knoppix, Ubuntu... etc.) The other is for Red Hat based systems
(Fedora, Mandriva... etc.) They are not installed by default. You may
install them so that vsntp will start as a daemon after each reboot.
Installion is easy. You have to be root.
Installation is easy. You have to be root.
DEBIAN BASED SYSTEMS
@ -31,7 +31,7 @@ server. Once finished, run:
And watch the syslog. vsntp shall start working.
To run it every time the system boots, use updat-rc.d:
To run it every time the system boots, use update-rc.d:
# update-rc.d vsntp defaults 23

View File

@ -1,59 +0,0 @@
vsntp SysV init.d 启动程式读我说明
目录
* 前言
* Debian 类系统
* Red Hat 类系统
前言
  自 2.0.0 版起, vsntp 新增了两个 SysV 式的启动程式,及一个启动设定档。
一个程式是 Debian 类的系统(如 Knoppix 、 Ubuntu 等)专用,另一个则是
Red Hat 类系统专用(如 Fedora 、 Mandriva 等)。安装 vsntp 时,不会自动安
装这些档案。若你希望每次系统启动都会自动启动 vsntp ,你可以安装这些档案。
  安装不难。你要先切为 root 的权限。
Debian 类系统
  将档案复制到相关目录:
# cp vsntp.debian /etc/init.d/vsntp
# cp vsntp /etc/default/vsntp
  编辑 /etc/default/vsntp ,依你的环境需求修改其中的设定。记得一定要将
SERVER= 那一行前的 # 符号去掉,改为你自己架的时间伺服器。改好后,执行:
# /etc/init.d/vsntp start
  查阅 syslog 记录档,应该就会开始校时了。
  若要在每次系统启动时自动执行,可以跑 updat-rc.d
# update-rc.d vsntp defaults 23
  23 是 Debian NTP 套件的启动顺序。你也可以自设适当的启动顺序。
Red Hat 类系统
  将档案复制到相关目录:
# cp vsntp.redhat /etc/init.d/vsntp
# cp vsntp /etc/sysconfig/vsntp
  编辑 /etc/sysconfig/vsntp ,依你的环境需求修改其中的设定。记得一定
要将 SERVER= 那一行前的 # 符号去掉,改为你自己架的时间伺服器。改好后,
执行:
# /etc/init.d/vsntp start
  查阅 syslog 记录档,应该就会开始校时了。
  若要在每次系统启动时自动执行,可以跑 chkconfig
# chkconfig --add vsntp
依玛猫
imacat@mail.imacat.idv.tw
2007-03-30

View File

@ -1,59 +0,0 @@
vsntp SysV init.d 啟動程式讀我說明
目錄
* 前言
* Debian 類系統
* Red Hat 類系統
前言
  自 2.0.0 版起, vsntp 新增了兩個 SysV 式的啟動程式,及一個啟動設定檔。
一個程式是 Debian 類的系統(如 Knoppix 、 Ubuntu 等)專用,另一個則是
Red Hat 類系統專用(如 Fedora 、 Mandriva 等)。安裝 vsntp 時,不會自動安
裝這些檔案。若妳希望每次系統啟動都會自動啟動 vsntp ,妳可以安裝這些檔案。
  安裝不難。妳要先切為 root 的權限。
Debian 類系統
  將檔案複製到相關目錄:
# cp vsntp.debian /etc/init.d/vsntp
# cp vsntp /etc/default/vsntp
  編輯 /etc/default/vsntp ,依妳的環境需求修改其中的設定。記得一定要將
SERVER= 那一行前的 # 符號去掉,改為妳自己架的時間伺服器。改好後,執行:
# /etc/init.d/vsntp start
  查閱 syslog 記錄檔,應該就會開始校時了。
  若要在每次系統啟動時自動執行,可以跑 updat-rc.d
# update-rc.d vsntp defaults 23
  23 是 Debian NTP 套件的啟動順序。妳也可以自設適當的啟動順序。
Red Hat 類系統
  將檔案複製到相關目錄:
# cp vsntp.redhat /etc/init.d/vsntp
# cp vsntp /etc/sysconfig/vsntp
  編輯 /etc/sysconfig/vsntp ,依妳的環境需求修改其中的設定。記得一定
要將 SERVER= 那一行前的 # 符號去掉,改為妳自己架的時間伺服器。改好後,
執行:
# /etc/init.d/vsntp start
  查閱 syslog 記錄檔,應該就會開始校時了。
  若要在每次系統啟動時自動執行,可以跑 chkconfig
# chkconfig --add vsntp
依瑪貓
imacat@mail.imacat.idv.tw
2007-03-30

View File

@ -1,8 +1,8 @@
#!/bin/sh
# start and stop the SNTP client for Virtual PC
# LSB-convension comments
# See: http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
# LSB-convention comments
# See: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
### BEGIN INIT INFO
# Provides: vsntp
# Required-Start: $network $time
@ -11,20 +11,20 @@
# Default-Stop: 0 1 6
# Short-Description: start and stop the SNTP client for Virtual PC
# Description: vsntp is a SNTP client for Virtual PC that synchronize
# time periodically for systems without hardward RTC.
# time periodically for systems without hardware RTC.
### END INIT INFO
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
THISFILE=${0##*/}
THIS_FILE=${0##*/}
VERSION=1.1.0
AUTHORNAME=imacat
AUTHORMAIL=imacat@mail.imacat.idv.tw
AUTHOR_NAME=imacat
AUTHOR_MAIL=imacat@mail.imacat.idv.tw
DESC="SNTP client for Virtual PC"
THISCONF=/etc/default/vsntp
THIS_CONF=/etc/default/vsntp
# source the configuration
test -e $THISCONF && . $THISCONF
test -e $THIS_CONF && . $THIS_CONF
case "$SCHEDULER" in
alarm|a|-a|--alarm)
SCHEDULER=-a ;;
@ -32,32 +32,32 @@ alarm|a|-a|--alarm)
SCHEDULER=-s ;;
esac
BINPATH=/usr/sbin/vsntp
BINNAME=${BINPATH##*/}
PIDFILE=/var/run/$BINNAME.pid
RUNUSER=root
BIN_PATH=/usr/sbin/vsntp
BIN_NAME=${BIN_PATH##*/}
PID_FILE=/var/run/$BIN_NAME.pid
RUN_USER=root
# default values -- do not change anything here
_DEFSYNC_INTERVAL=900
_DEFSCHEDULER=-s
_DEF_SYNC_INTERVAL=900
_DEF_SCHEDULER=-s
# startup options
OPTS=""
test -n "$SCHEDULER" -a "$SCHEDULER" != "$_DEFSCHEDULER" && OPTS="$OPTS $SCHEDULER"
test -n "$SYNC_INTERVAL" -a "$SYNC_INTERVAL" != "$_DEFSYNC_INTERVAL" && OPTS="$OPTS -i $SYNC_INTERVAL"
test -n "$SCHEDULER" -a "$SCHEDULER" != "$_DEF_SCHEDULER" && OPTS="$OPTS $SCHEDULER"
test -n "$SYNC_INTERVAL" -a "$SYNC_INTERVAL" != "$_DEF_SYNC_INTERVAL" && OPTS="$OPTS -i $SYNC_INTERVAL"
OPTS="$OPTS $SERVER"
# sanity checks
if test ! -n "$SERVER"; then
echo "$THISFILE: You must set the SERVER in $THISCONF" >&2
echo "$THIS_FILE: You must set the SERVER in $THIS_CONF" >&2
exit 1
fi
if test ! -x $BINPATH; then
echo "$THISFILE: Missing valid daemon program at $BINPATH" >&2
if test ! -x $BIN_PATH; then
echo "$THIS_FILE: Missing valid daemon program at $BIN_PATH" >&2
exit 1
fi
if test -n "$USER" -a ! "$USER" = "root"; then
echo "$THISFILE: You need to be root to run this script." >&2
echo "$THIS_FILE: You need to be root to run this script." >&2
exit 1
fi
@ -65,9 +65,9 @@ start () {
echo -n "Starting $DESC:"
RETVAL=0
echo -n " $BINNAME"
start-stop-daemon --start --startas $BINPATH --quiet \
--pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH -- $OPTS
echo -n " $BIN_NAME"
start-stop-daemon --start --startas $BIN_PATH --quiet \
--pidfile $PID_FILE --name $BIN_NAME --user $RUN_USER --exec $BIN_PATH -- $OPTS
RETVALS=$?
test $RETVALS = 0 || { echo -n ":failed"; RETVAL=$RETVALS; }
@ -79,12 +79,12 @@ stop () {
echo -n "Stopping $DESC:"
RETVAL=0
echo -n " $BINNAME"
echo -n " $BIN_NAME"
start-stop-daemon --stop --quiet \
--pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH
--pidfile $PID_FILE --name $BIN_NAME --user $RUN_USER --exec $BIN_PATH
RETVALS=$?
test $RETVALS = 0 || { echo -n ":failed"; RETVAL=$RETVALS; }
rm -f $PIDFILE
rm -f $PID_FILE
echo "."
return $RETVAL
@ -102,12 +102,12 @@ status () {
RETVAL=0
start-stop-daemon --stop --signal 0 --quiet \
--pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH
--pidfile $PID_FILE --name $BIN_NAME --user $RUN_USER --exec $BIN_PATH
RETVALS=$?
if test $RETVALS = 0; then
echo "$DESC $BINNAME is up and running ($(<$PIDFILE))."
echo "$DESC $BIN_NAME is up and running ($(<$PID_FILE))."
else
echo "$DESC $BINNAME is not running (or some problem may exists)."
echo "$DESC $BIN_NAME is not running (or some problem may exists)."
RETVAL=$RETVALS
fi
@ -123,7 +123,7 @@ while test $# != 0; do
-h|--help)
cat << EOF
Start and/or stop the $DESC
Usage: $THISFILE {start|stop|restart|force-reload|status}
Usage: $THIS_FILE {start|stop|restart|force-reload|status}
start Start the daemon.
stop Stop the daemon.
@ -131,21 +131,21 @@ Usage: $THISFILE {start|stop|restart|force-reload|status}
force-reload Enforce a reload to the configuration file.
status Display the daemon status.
-h,--help Display this help.
-v,--version Display the version infomation.
-v,--version Display the version information.
Report bugs to $AUTHORNAME <$AUTHORMAIL>
Report bugs to $AUTHOR_NAME <$AUTHOR_MAIL>
EOF
exit 0
;;
-v|--version)
cat << EOF
$THISFILE version $VERSION by $AUTHORNAME <$AUTHORMAIL>
$THIS_FILE version $VERSION by $AUTHOR_NAME <$AUTHOR_MAIL>
EOF
exit 0
;;
*)
echo "$THISFILE: unrecognized argument: $1" >&2
echo "Try \`$THISFILE --help' for more infomation" >&2
echo "$THIS_FILE: unrecognized argument: $1" >&2
echo "Try \`$THIS_FILE --help' for more information" >&2
exit 1
;;
esac
@ -154,8 +154,8 @@ done
# no action specified
if test -z "$action"; then
echo "$THISFILE: what do you want to do now?" >&2
echo "Try \`$THISFILE --help' for more infomation" >&2
echo "$THIS_FILE: what do you want to do now?" >&2
echo "Try \`$THIS_FILE --help' for more information" >&2
exit 1
fi

View File

@ -7,8 +7,8 @@
# processname: vsntp
# config: /etc/sysconfig/vsntp
# LSB-convension comments
# See: http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
# LSB-convention comments
# See: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
### BEGIN INIT INFO
# Provides: vsntp
# Required-Start: $network $time
@ -17,16 +17,16 @@
# Default-Stop: 0 1 6
# Short-Description: start and stop the SNTP client for Virtual PC
# Description: vsntp is a SNTP client for Virtual PC that synchronize
# time periodically for systems without hardward RTC.
# time periodically for systems without hardware RTC.
### END INIT INFO
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
# initialize the environment
THISFILE="${0##*/}"
THIS_FILE="${0##*/}"
VERSION="1.0.0"
AUTHORNAME=imacat
AUTHORMAIL=imacat@mail.imacat.idv.tw
AUTHOR_NAME=imacat
AUTHOR_MAIL=imacat@mail.imacat.idv.tw
lock=/var/lock/subsys/vsntp
# Source function library.
@ -49,13 +49,13 @@ alarm|a|-a|--alarm)
esac
# default values -- do not change anything here
_DEFSYNC_INTERVAL=900
_DEFSCHEDULER=-s
_DEF_SYNC_INTERVAL=900
_DEF_SCHEDULER=-s
RETVAL="0"
OPTIONS=""
test -n "$SCHEDULER" -a "$SCHEDULER" != "$_DEFSCHEDULER" && OPTIONS="$OPTIONS $SCHEDULER"
test -n "$SYNC_INTERVAL" -a "$SYNC_INTERVAL" != "$_DEFSYNC_INTERVAL" && OPTIONS="$OPTIONS -i $SYNC_INTERVAL"
test -n "$SCHEDULER" -a "$SCHEDULER" != "$_DEF_SCHEDULER" && OPTIONS="$OPTIONS $SCHEDULER"
test -n "$SYNC_INTERVAL" -a "$SYNC_INTERVAL" != "$_DEF_SYNC_INTERVAL" && OPTIONS="$OPTIONS -i $SYNC_INTERVAL"
OPTIONS="$OPTIONS $SERVER"
# See how we were called.
@ -93,28 +93,28 @@ while [ "$#" != "0" ]; do
-h|--help)
cat << EOF
Start and/or stop the SNTP client for Virtual PC
Usage: $THISFILE {start|stop|restart|status}
Usage: $THIS_FILE {start|stop|restart|status}
start Start the daemon.
stop Stop the daemon.
restart Stop and restart the daemon.
status Display the daemon status
-h,--help Display this help.
-v,--version Display the version infomation.
-v,--version Display the version information.
Report bugs to $AUTHORNAME <$AUTHORMAIL>
Report bugs to $AUTHOR_NAME <$AUTHOR_MAIL>
EOF
exit 0
;;
-v|--version)
cat << EOF
$THISFILE v$VERSION by $AUTHORNAME <$AUTHORMAIL>
$THIS_FILE v$VERSION by $AUTHOR_NAME <$AUTHOR_MAIL>
EOF
exit 0
;;
*)
echo "$THISFILE: unrecognized argument: $1"
echo "Try \`$THISFILE --help' for more infomation"
echo "$THIS_FILE: unrecognized argument: $1"
echo "Try \`$THIS_FILE --help' for more information"
exit 1
;;
esac
@ -124,7 +124,7 @@ done
# check the arguments
if [ -z "$action" ]; then
cat << EOF
Usage: $THISFILE {start|stop|restart|status}
Usage: $THIS_FILE {start|stop|restart|status}
EOF
exit 0
fi

View File

@ -13,7 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* Filename: vsntp.c