小编Car*_*wig的帖子

检查 ntp 状态和系统时间同步的脚本

寻找脚本来(1)检查 ntp 的状态和(2)它是否在给定时间服务器(例如123.456.789.10)的+/- 1 秒内。(3)另外,还要检查系统时间,看时区设置是否正确(例如PST

这是我到目前为止所拥有的,检查 ntp 的状态:

#!/bin/bash

if [[ ! -x /usr/bin/ntpstat ]]
then
  echo "ntpstat is NOT installed: please install it"
  exit 3

res=$(/usr/bin/ntpstat)
rc=$?

case $rc in
  0 )
    echo "clocks are synchronized"
    ;;
  1 )
    echo "WARNING: clocks are NOT synchronized"
    ;;
  2 )
    echo "CRITICAL: NTPD IS DOWN -- NO STATUS"
    ;;
esac
Run Code Online (Sandbox Code Playgroud)

linux shell-script ntpd ntp

3
推荐指数
1
解决办法
2万
查看次数

查看已删除文件列表

我已经执行了rm -f *.gz大约 30 天前。有没有办法找出被删除的文件列表?

rm deleted-files

2
推荐指数
1
解决办法
8604
查看次数

标签 统计

deleted-files ×1

linux ×1

ntp ×1

ntpd ×1

rm ×1

shell-script ×1