send system time to a file
I would like to send the system tme to a log ( /tmp/log ) in every 5 seconds , now I manually run "date >> /tmp/log" in every 5 seconds , it is OK , but how can I let it automatically do it ? thx
What I would like the log is =================== #vi /tmp/log Fri Aug 15 11:50:15 GMT 2008 Fri Aug 15 11:50:20 GMT 2008 Fri Aug 15 11:50:25 GMT 2008 Fri Aug 15 11:50:30 GMT 2008 Fri Aug 15 11:50:35 GMT 2008 Fri Aug 15 11:50:40 GMT 2008 |
Code:
while : ; do |
You could make a shell script (which I will call sendtime) like this:
Code:
#!/bin/bash There are ways to make it automatically start up when you start the computer or when you log in. If that was what you wanted, you'll have to wait for somebody more knowledgeable. |
If you are trying to debug clock problems on that box you'll need to have another machine do it. Essentially 2 scripts one on the other machine and one on the machine your doing the clock check on. Setup a ssh key so you can do passwordless connects, then run a script like those above except instead of the date command it does an ssh command that runs a script that does the date >> /tmp/log on the machine your doing the clock check on.
|
All times are GMT -5. The time now is 10:37 AM. |