Linux / UNIX Tech Support Forum
This is a discussion on script to ping + date within the Shell scripting forums, part of the Development/Scripting category; hello gurus, i want make log file contains time (day/month/year hour:min) with status from ping command. how should i make ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
hello gurus,
i want make log file contains time (day/month/year hour:min) with status from ping command. how should i make shell script ? thank you |
| Sponsored Links | ||
|
|
|
||||
|
Code:
#!/bin/bash LOG=~/ping.log NOW=$(date) OUT=$(ping -c 1 google.com | grep packets) echo "$NOW : $OUT" >>$LOG Code:
cat ~/ping.log
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell date command for manipulation and formatting date | newbie4 | Shell scripting | 4 | 28-10-2008 07:33 PM |
| Unable to ping ??? | raina_ajeet | Linux software | 2 | 24-04-2008 05:39 PM |
| How to calculate date minus 72 hours? | svinopas | Shell scripting | 1 | 09-10-2007 09:37 PM |
| Can't ping to a linux box by its machine name. | lacloai | Linux software | 6 | 17-05-2007 02:56 AM |
| How can I rename a file by its date? | warren | Linux software | 5 | 30-03-2006 12:11 PM |