[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博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2936976/ ,如需转载,请注明出处,否则将追究法律责任。