我想在date -s <string>
使用命令时运行 shell 脚本。例如,我想通过在 shell 脚本中执行以下命令将命令记录到文件 /tmp/user.log
logger -p user.notice "date -s command executed" -f /tmp/user.log
Run Code Online (Sandbox Code Playgroud)
在shelldate -s <string>
上执行时如何运行shell脚本?
为了使它更通用,当其他人在我的系统上发出特定的 linux 命令时,我想运行我的 shell 脚本。这该怎么做?
当我的系统启动时,它显示以下消息。
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: RTNETLINK answers: Invalid argument
[ OK ]
Bringing up interface eth1: RTNETLINK answers: Invalid argument
[ OK ]
Bringing up interface eth2: RTNETLINK answers: Invalid argument
[ OK ]
Bringing up interface eth3: RTNETLINK answers: Invalid argument
[ OK ]
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况。通常它不会给出消息RTNETLINK answers: Invalid argument
我做ifconfig
了,输出是
eth0 Link encap:Ethernet HWaddr 00:00:50:6D:56:B4
inet addr:120.0.10.137 Bcast:120.0.255.255 Mask:255.255.255.0
inet6 addr: fe80::200:50ff:fe6d:56b4/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 …
Run Code Online (Sandbox Code Playgroud) 我做了这个date
命令,它给出了以下输出
root@localhost:~$ date
Thu Dec 30 14:19:47 UTC 2010
Run Code Online (Sandbox Code Playgroud)
然后我使用date -s
命令修改了日期,该命令给出了以下输出
root@localhost:~$ date -s "12/30/2010 JST 14:19:47"
Thu Dec 30 05:19:47 UTC 2010
Run Code Online (Sandbox Code Playgroud)
我注意到时间更改为比 UTC 时间晚 9 小时以准确显示 JST 时间。但是您可以看到时区仍然显示UTC。为什么它显示正确的时间和错误的时区?
谢谢
在哪里可以找到 Linux 实用程序和守护程序的源代码。基本上我想知道Linux内核以外的源代码库。