Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <006501c1779a$8252add0$2701010a@crosstrust.com> From: "Daniel Meier" To: Subject: Shell process identification Date: Tue, 27 Nov 2001 15:23:21 -0800 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=SHA1; boundary="----=_NextPart_000_005F_01C17757.74188A70" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 ------=_NextPart_000_005F_01C17757.74188A70 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0060_01C17757.74188A70" ------=_NextPart_001_0060_01C17757.74188A70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I want to cron/at a bash script but have it check to see if another = instance of the script is already running. I did a ps -Wl and a ps -ef while I had the script running and while I = saw the /usr/bin/bash executables (my current shell and the shell I = wanted to detect) they did not contain enough information to = differentiate between the two shells. Any ideas of how I can determine this? I thought of using a temp file, = but if the script terminates abnormally it might not cleanup it's files, = causing the next cron job to not run, thinking that the other script is = still running. Basically I'm trying to introduce some error recovery into a script. So = that if it terminates, another instance will be started. ------=_NextPart_001_0060_01C17757.74188A70 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I want to cron/at a bash = script but have=20 it check to see if another instance of the script is already=20 running.
 
I did a ps -Wl and a ps -ef while I had = the script=20 running and while I saw the /usr/bin/bash executables (my current shell = and the=20 shell I wanted to detect) they did not contain enough information to=20 differentiate between the two shells.
 
Any ideas of how I can determine this? = I thought of=20 using a temp file, but if the script terminates abnormally it might not = cleanup=20 it's files, causing the next cron job to not run, thinking that the = other script=20 is still running.
 
Basically I'm trying to introduce some = error=20 recovery into a script. So that if it terminates, another instance will = be=20 started.
------=_NextPart_001_0060_01C17757.74188A70-- ------=_NextPart_000_005F_01C17757.74188A70 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKUDCCAoYw ggHvoAMCAQICAQEwDQYJKoZIhvcNAQEFBQAwTTEXMBUGA1UEChMOQ1JPU1NUUlVTVC5jb20xMjAw BgNVBAMTKUNST1NTVFJVU1QuY29tIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTAxMDUy MjA3MDAwMFoXDTExMDUyMjA3MDAwMFowTTEXMBUGA1UEChMOQ1JPU1NUUlVTVC5jb20xMjAwBgNV BAMTKUNST1NTVFJVU1QuY29tIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MIGfMA0GCSqGSIb3 DQEBAQUAA4GNADCBiQKBgQC2o9Ko5U7U6u2rHshkE/QX+ERzFVNx4Kz9lRyMGZuiuchqVnblqJvU Rn5YWL4rfKLfu5b8o3uRa9d1w15uM1UDI3mjdqrHy54+BV8TQQXmZ5RasAKaZ1/5TJ8GzmPYEnFJ NGSyJ+aht/K/SzDdcj+OrXsRgM83EpvdKpG9l+hFfQIDAQABo3YwdDARBglghkgBhvhCAQEEBAMC AAcwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUIzlMpyt8HB4VOdpukwrmyagqBGQwHwYDVR0j BBgwFoAUIzlMpyt8HB4VOdpukwrmyagqBGQwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUA A4GBAJ/mlxNVNrnClSjWEsWJbvBdtZnhmwW2eGX+j8NXcsQIx5qGT8RnYfBdu8lUC2JfICNoAj5Z O/a1N/SZTjYEn8l8/e6WcWs59i2XrI7ZazYbG6D67I7Al1/Tvlw9F9Da+J09C37k6DDzUfZZ78HY yxsP/tfMK1Fwb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