[20230224]ssh date執行問題.txt

lfree發表於2023-02-24

[20230224]ssh date執行問題.txt

--//生產系統rac,兩臺伺服器出現實際不同步問題.
--//grid使用者下經常報.
2023-02-24 10:05:41.581:
[ctssd(11799)]CRS-2409:The clock on host fyhis1 is not synchronous with the mean cluster time. No action has been taken
as the Cluster Time Synchronization Service is running in observer mode.

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.101.5   139.199.215.251  3 u 1002 1024  377    6.574   -2.375   2.133

$ date ; ssh 192.168.90.15 date  ; date
Fri Feb 24 10:44:22 CST 2023
Fri Feb 24 10:44:22 CST 2023
Fri Feb 24 10:44:22 CST 2023

$ cluvfy comp clocksync -n all -verbose
...
Time Server: 139.199.215.251
Time Offset Limit: 1000.0 msecs
  Node Name     Time Offset               Status
  ------------  ------------------------  ------------------------
  fyhis2        2.891                     passed
  fyhis1        -2.375                    passed
Time Server "139.199.215.251" has time offsets that are within permissible limits for nodes "[fyhis2, fyhis1]".
Clock time offset check passed

Result: Clock synchronization check using Network Time Protocol(NTP) passed

Oracle Cluster Time Synchronization Services check passed

Verification of Clock Synchronization across the cluster nodes was successful.

--//差距也不是很大,問了一下別人,問題不是很大,可以不用理會它.但是我想執行如下:

$ /bin/date +'%F %T.%N %s' ; ssh 192.168.90.15 /bin/date  +"%F %T.%N %s" ; /bin/date  +'%F %T.%N %s'
2023-02-24 10:47:11.106354400 1677206831
/bin/date: extra operand `%T.%N'
Try `/bin/date --help' for more information.
2023-02-24 10:47:11.206980548 1677206831

$ /bin/date +'%F %T.%N' ; ssh 192.168.90.15 /bin/date  +"%F %T.%N" ; /bin/date  +'%F %T.%N'
2023-02-24 10:47:47.060313646
/bin/date: extra operand `%T.%N'
Try `/bin/date --help' for more information.
2023-02-24 10:47:47.158338087

--//很明顯ssh IP date 模式這樣執行有問題.

$ ssh 192.168.90.15 /bin/date  +"%T.%N"
10:48:56.483221063
--//可以大致猜測問題出在空格上面.把%T.%N'當作第2個引數.

$ ssh 192.168.90.15 /bin/date  +"%F%T.%N"
2023-02-2410:49:32.176477106

$ ssh 192.168.90.15 /bin/date  "+"%F %T.%N""
/bin/date: extra operand `%T.%N'
Try `/bin/date --help' for more information.
--//兩個引號不能相同.

$ ssh 192.168.90.15 /bin/date  '+"%F %T.%N"'
2023-02-24 10:51:07.812314545

$ date +'%F %T.%N' ; ssh 192.168.90.15 /bin/date  "+'%F %T.%N'" ; date  +'%F %T.%N'
2023-02-24 10:51:44.133259784
2023-02-24 10:51:44.235091945
2023-02-24 10:51:44.243516036

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2936976/,如需轉載,請註明出處,否則將追究法律責任。

相關文章