duzhuo's-blog

学无止境

时间服务器 - NTP

一、NTP 简介

网络时间协议(英语:Network Time Protocol,缩写:NTP)是在数据网络潜伏时间可变的计算机系统之间通过分组交换进行时钟同步的一个网络协议,位于 OSI 模型的应用层。自 1985 年以来,NTP 是目前仍在使用的最古老的互联网协议之一。NTP 由特拉华大学的 David L. Mills(英语:David L. Mills)设计。

NTP 意图将所有参与计算机的协调世界时(UTC)时间同步到几毫秒的误差内

NTP 要点:

  • 地球共有 24 个时区,而以格林威治时间 (GMT) 为标准时间;
  • 中国本地时间为 GMT +8 小时;
  • 最准确的时间为使用原子钟 (Atomic clock) 所计算的,例如 UTC (Coordinated Universal Time) 就是一例;
  • Linux 系统本来就有两种时间,一种是 Linux 以 1970/01/01 开始计数的系统时间,一种则是 BIOS 记载的硬件时间;
  • Linux 可以透过网络校时,最常见的网络校时为使用 NTP 服务器,这个服务启动在 udp port 123
  • 时区档案主要放置于 /usr/share/zoneinfo/ 目录下,而本地时区则参考 /etc/localtime
  • NTP 服务器为一种阶层式的服务,所以 NTP 服务器本来就会与上层时间服务器作时间的同步化, 因此 nptdntpdate 两个指令不可同时使用;
  • NTP 服务器的联机状态可以使用 ntpstatntpq -p 来查询;
  • NTP 提供的客户端软件为 ntpdate 这个指令;
  • 在 Linux 下想要手动处理时间时,需以 date 设定时间后,以 hwclock -w 来写入 BIOS 所记录的时间。
  • NTP 服务器之间的时间误差不可超过 1000 秒,否则 NTP 服务会自动关闭。

更多 NTP 详情可以参考:鸟哥的 Linux 私房菜– NTP 时间服务器

二、ntpd 服务

环境:CentOS

yum 安装

阅读全文 »

Samba 应用

samba 是在 Linux 和 UNIX 系统上实现 SMB 协议的一个免费软件。

samba 提供了在不同计算机(即使操作系统不同)上共享服务的能力。

关键词:samba, selinux

1. 安装配置 samba

本文将以一个完整的示例来展示如何配置 samba 来实现 Linux 和 Windows 的文件共享。

目标:假设希望共享 Linux 服务器上的 /share/fs 目录。

1.1. 查看是否已经安装 samba

  • CentOS:rpm -qa | grep samba
  • Ubuntu:dpkg -l | grep samba

1.2. 安装 samba 工具

  • CentOS:yum install -y samba samba-client samba-common
  • Ubuntu:sudo apt-get install -y samba samba-client

1.3. 配置 samba

阅读全文 »

Systemd 应用

搬运自:Systemd 入门教程:命令篇Systemd 入门教程:实战篇

Systemd 是 Linux 系统工具,用来启动守护进程,已成为大多数发行版的标准配置。

本文介绍它的基本用法,分为上下两篇。今天介绍它的主要命令,下一篇介绍如何用于实战。

1. 由来

历史上,Linux 的启动一直采用init进程。

下面的命令用来启动服务。

1
2
3
$ sudo /etc/init.d/apache2 start
# 或者
$ service apache2 start

这种方法有两个缺点。

一是启动时间长。init进程是串行启动,只有前一个进程启动完,才会启动下一个进程。

阅读全文 »

Vim 应用

1. 概念

1.1. 什么是 vim

Vim 是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。和 Emacs 并列成为类 Unix 系统用户最喜欢的编辑器。

1.2. Vim 的模式

基本上 vi/vim 共分为三种模式,分别是命令模式(Command mode)插入模式(Insert mode)底线命令模式(Last line mode)

1.2.1. 命令模式

用户刚刚启动 vi/vim,便进入了命令模式。

此状态下敲击键盘动作会被 Vim 识别为命令,而非输入字符。

1.2.2. 插入模式

阅读全文 »

oh-my-zsh 应用

1. Zsh 简介

1.1. Zsh 是什么

使用 Linux 的人都知道:*Shell_ 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁。Shell 既是一种命令语言,又是一种程序设计语言

Shell 的类型有很多种,linux 下默认的是 bash,虽然 bash 的功能已经很强大,但对于以懒惰为美德的程序员来说,bash 的提示功能不够强大,界面也不够炫,并非理想工具。

Zsh 也是一种 Shell(据传说 99% 的 Bash 操作 和 Zsh 是相同的),它的功能极其强大,只是配置过于复杂,起初只有极客才在用。后来,出现了一个名叫 oh-my-zsh 的开源项目,使用 zsh 就变得十分简易了。

2. Zsh 安装

2.1. 环境要求

  • CentOS 6.7 64 bit
  • root 用户

2.2. 安装 zsh

阅读全文 »

csgo-practice-mode

Build status
GitHub Downloads
Discord Chat

Status: Supported, actively developed.

Practice Mode is a sourcemod plugin for helping players/teams run practices. See this YouTube video for a demonstration. Check out the features and command list below for a better understanding of all the tools practicemode provides.

Download

Download from the releases section.

You may also download the latest development build if you wish. If you report any bugs from these, make sure to include the build number (when typing sm plugins list into the server console, the build number will be displayed with the plugin version).

Installation

  1. Confirm you have SourceMod and MetaMod:Source. You must have a 1.9+ build of sourcemod.

  2. Extract all files in the release zip from above to the csgo server directory. You should see a practicemode.smx file in addons/sourcemod/plugins.

  3. To start practicemode via the .setup command, either add yourself as a sourcemod admin or remove the admin requirement.

Note: access to the .setup requires having the sourcemod admin changemap flag (“g”) by default. See the wiki for more information on changing how admin access works.

阅读全文 »

simple-practicemode

Intro

基于csgo-practice-mode,删减了部分内容,更好地适配csgowiki-pack

Feature

  • 不再与csgo-pug-setupget5兼容。simple-practicemode是一个单独且纯粹的跑图插件。
  • 删除原跑图插件的本地道具仓库功能,.nades.cats相关功能取消。因为csgowiki-pack已经具有部分道具合集的功能。
  • 重构botmimic插件,使其适配sourcemod v1.11语法,重构后的插件名/Libary名称为botmimic_fix
  • 新增计时器面板功能,.timers。timers开启,整合了三种计时器类型。
  • 新增。command指令触发方式,方便中文输入法用户避免频繁切换输入法。
  • 更全面友好的汉化内容。

Compiling

necessary .inc needed

compiled files:

  • botmimic_fix.smx
  • csutils.smx
  • practicemode.smx
阅读全文 »

提问的智慧

PRs Welcome

How To Ask Questions The Smart Way

Copyright © 2001,2006,2014 Eric S. Raymond, Rick Moen

本指南英文版版权为 Eric S. Raymond, Rick Moen 所有。

原文网址:http://www.catb.org/~esr/faqs/smart-questions.html

Copyleft 2001 by D.H.Grand(nOBODY/Ginux), 2010 by Gasolin, 2015 by Ryan Wu

本中文指南是基于原文 3.10 版以及 2010 年由 Gasolin 所翻译版本的最新翻译;

协助指出翻译问题,发 issue,或直接发 pull request 给我。

本文另有繁體中文版

阅读全文 »
0%