View Full Version : On File Change
July 29th, 2008, 07:39 AM
I'm running a NeoStats server for a friends IRC network and sometimes the connection is lost. I've made shell scripts before but I have never seen before how to do this. I want a way for the script to sit idle until it notices that the pid file of the server has changed. When the file is changed it should restart the server. Any help is appreciated.
July 29th, 2008, 02:39 PM
i am also a noob, but thought to give it a try (i havent tested it)
while sleep 5s;do
if [ "$init_pid"==`pgrep server`]; then
i actually cuoldnt understand what you mean by "pid file" , i supposed it to be just "pid" ...hope that doesnt mess up things :)
July 29th, 2008, 09:06 PM
can you please reply if it worked ??
July 29th, 2008, 10:38 PM
I worked off your code and changed to meet my needs. Thanks a lot.
while sleep 60s;do
if test -r $dir/$pidfile; then
echo "Server is already running."
echo "Starting server..."
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.