Re: Pause a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 06, 2007 at 09:57:16AM -0500, Mark Haney wrote:
> I'm not sure this will help.  Here's the situation:
> 
> script1 - checks for the existence of test.pid
> script2 - the job that actually will create the pid

I'm answering this, instead of the original request, since you actually
described what you're trying to do more clearly here.

There are several ways to do this, but probably the simplest is to put the
following code snippet into your script1 (modify as appropriate for your
environment, of course):

  PIDFILE=/var/state/app/test.pid	# Or wherever, of course
  RETRY_INTERVAL=10;
  MAX_RETRIES=10;

  RETRY_COUNT=0;

  while [ $RETRY_COUNT -le $MAX_RETRIES ]
  do
  	if [ ! -f $PIDFILE ]
	then
		let RETRY_COUNT=$RETRY_COUNT+1;
		sleep $RETRY_INTERVAL;
	else
		break;
	fi;
  done;

There are more elegant approaches, of course--using a named pipe would be
the simplest of those--but this will work.

Cheers,
--
	Dave Ihnat
	President, DMINET Consulting, Inc.
	dihnat@xxxxxxxxxx

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux