From linux at codehelp.co.uk Thu Jan 8 17:16:14 2004 From: linux at codehelp.co.uk (Neil Williams) Date: Thu Aug 5 00:28:53 2004 Subject: DCPM: return values Message-ID: <200401082316.14899.linux@codehelp.co.uk> Is it as easy as it would appear to report a return value from a perl script run from the command line? I want to wrap a troublesome Perl script (you can all guess which project this is for) in a bash script. (It'll become clear, don't fret.) If returnvalue == 0, all OK, exit bash script. If return value <> 1 - immediately re-run script. Reasons: It's a workaround for a bug in the module that leaves the module unstable on refused connections (yes, it's my old friend Z39.50 again). There are two critical data objects/addresses - a manager reference and a connection handle. The manager reference can only be safely destroyed by calling the connection handle with the close() method. The problem comes that $conn comes back undefined in certain error states so I can't call $conn->close(); That leaves the memory in a shambles and the next $mgr-> operation (of any kind) leads to either a SIGPIPE or Illegal Seek. Handling the SIGPIPE isn't the answer because the module is truly unstable at this point. However, there is a LOT of work for this script to perform and I cannot afford to let it just die() until the next cron slot comes around. When it DOES work, it can take a max of 6 minutes to complete. To be safe, cron is set at 10 minutes. That leaves many times when it's bombed out after 30 seconds and there's no activity. The die() handler currently drops me back to a last; statement and the MySQL connection is then closed. Can I just use return $errno; and expect bash to pick it up? Well, no: $ perl -e 'return 1;' Can't return outside a subroutine I haven't done a lot of conditional bash scripts - what is the best way to do it? -- Neil Williams ============= http://www.codehelp.co.uk/ http://www.dclug.org.uk/ http://www.isbn.org.uk/ http://sourceforge.net/projects/isbnsearch/ http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20040108/e14ff920/attachment.bin From linux at codehelp.co.uk Thu Jan 8 17:25:32 2004 From: linux at codehelp.co.uk (Neil Williams) Date: Thu Aug 5 00:28:53 2004 Subject: DCPM: Re: return values In-Reply-To: <200401082316.14899.linux@codehelp.co.uk> References: <200401082316.14899.linux@codehelp.co.uk> Message-ID: <200401082325.33489.linux@codehelp.co.uk> On Thursday 08 Jan 2004 11:16 pm, Neil Williams wrote about return values: > Is it as easy as it would appear to report a return value from a perl > script run from the command line? Ok, I should have tried this before posting: #!/bin/bash perl -e 'exit(1);' if [ $? -eq 1 ]; then perl -e 'print "script can start again\n";' fi So if I call exit I can restart the script. ? There's no chance of the module not being re-initialised? Should I use a 1 second sleep in-between? -- Neil Williams ============= http://www.codehelp.co.uk/ http://www.dclug.org.uk/ http://www.isbn.org.uk/ http://sourceforge.net/projects/isbnsearch/ http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20040108/00a3b09e/attachment.bin From linux at codehelp.co.uk Thu Jan 15 13:14:19 2004 From: linux at codehelp.co.uk (Neil Williams) Date: Thu Aug 5 00:28:53 2004 Subject: DCPM: January meeting? Message-ID: <200401151914.20436.linux@codehelp.co.uk> Shall we do the January meeting in Plymouth? I've used the Tamar PH in Crownhill for previous small meetings and full directions are in the DCLUG archive: http://www.dclug.org.uk/archive-Nov02-May03/msg02318.html including a link to a streetmap URL. Provided that there are no large sporting events on that night, it should be OK. 29th OK for people? 7:30pm? -- Neil Williams ============= http://www.codehelp.co.uk/ http://www.dclug.org.uk/ http://www.isbn.org.uk/ http://sourceforge.net/projects/isbnsearch/ http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20040115/7a4df288/attachment.bin From linux at codehelp.co.uk Mon Jan 26 16:28:33 2004 From: linux at codehelp.co.uk (Neil Williams) Date: Thu Aug 5 00:28:53 2004 Subject: DCPM: January meeting? In-Reply-To: <200401151914.20436.linux@codehelp.co.uk> References: <200401151914.20436.linux@codehelp.co.uk> Message-ID: <200401262228.41538.linux@codehelp.co.uk> On Thursday 15 Jan 2004 7:14 pm, Neil Williams wrote: > Shall we do the January meeting in Plymouth? In the absence of any affirmative replies, I think this should be postponed to February. BTW. Is there a problem with http://devoncornwall.pm.org/ ? I get a zero-byte page - usually a sign of a PHP syntax error and a restrictive config. -- Neil Williams ============= http://www.codehelp.co.uk/ http://www.dclug.org.uk/ http://www.isbn.org.uk/ http://sourceforge.net/projects/isbnsearch/ http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20040126/d60ca93d/attachment.bin