This is a discussion on If file modified execute a script within the Shell scripting forums, part of the Development/Scripting category; I have some server application running on FC6 but clients loose contact unless they restart client application after server ip ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
I have some server application running on FC6 but clients loose contact unless they restart client application after server ip has changed. And it changes once a day I think. I have inadyn running since clients connect to dyndns address but they still can't reconnect unless they restart client tool or I restart server application.
So I was hoping there is a way to run something that would restart server when it notices that inadyn.log file was modified. Since file is modified when it updates to new ip. |
| Sponsored Links | ||
|
|
|
||||
|
Hmm
You need to store your inadyn.log log file current time somewhere. Then you can monitor current time and compare with stored location. If both differ restart the server. Logic/script: Code:
#!/bin/sh file="/path/to/inadyn.log" fileatime="/etc/current.time" a="" b="" [ ! -f $fileatime ] && stat $file | grep Modify > $fileatime || : [ -f $fileatime ] && a="$(cat $fileatime)" || exit 1 b="$(stat $file | grep Modify)" if [ "$a" != "$b" ]; then echo "Restart server...." # update time stat $file | grep Modify > $fileatime fi
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script for ftp the file | vishal_titre | Shell scripting | 3 | 12-10-2007 09:40 AM |
| Make file script, need help understanding | shaziluk | Shell scripting | 0 | 09-16-2007 04:30 AM |
| script finding file and sorting | dementeddude | Shell scripting | 14 | 07-25-2006 06:30 PM |
| script on how to check if the file exists | warren | Shell scripting | 4 | 04-14-2006 06:51 PM |
| #why following cannot be execute? | ryan | Shell scripting | 7 | 03-16-2005 07:50 PM |