Date: Sat, 29 Mar 2003 15:45:48 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: cron job Message-ID: <20030329154548.GB33617@happy-idiot-talk.infracaninophi> In-Reply-To: <000801c2f60d$8373b040$0764a8c0@cyberzone.odessos.org> References: <000801c2f60d$8373b040$0764a8c0@cyberzone.odessos.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--mojUlQ0s9EVzWg2t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 29, 2003 at 05:09:01PM +0100, Martin Tsanov wrote: > Hello >=20 > I have a gateway with wireless interface wi0. From time to time it ha= ngs down > with the following log entry in /var/log/all.log >=20 > Mar 28 22:19:37 morpheus /kernel: wi0: failed to allocate 1594 bytes on N= IC > Mar 28 22:19:37 morpheus /kernel: wi0: tx buffer allocation failed > Mar 28 22:19:37 morpheus /kernel: wi0: wi_cmd: busy bit won't clear. > Mar 28 22:19:37 morpheus /kernel: wi0: failed to allocate 1594 bytes on N= IC > Mar 28 22:19:37 morpheus /kernel: wi0: mgmt. buffer allocation failed > Mar 28 22:20:42 morpheus /kernel: wi0: wi_cmd: busy bit won't clear. > Mar 28 22:21:42 morpheus /kernel: wi0: wi_cmd: busy bit won't clear. >=20 > I tried the following script, placed as a crontab entry to reboot the= system: >=20 > #!/bin/sh >=20 > result=3D`fping 212.50.x.xxx|cut -b 17-21` > result1=3D"alive" > if [ "$result1" =3D "$result" ]; then > echo $result > else > reboot > fi >=20 > This script works as expected when envoked from the shell, but when placed > as th following crontab entry: >=20 > */10 * * * * root /root/reb (reb is the scr= ipt name) >=20 > the system reboots regardless if 212.50.x.xxx is reachable or not. >=20 > What is the difference??? And what am I doing wrong?? Scripts run from cron(8) don't get anything like the environment settings you have when you try running the script from your login. Specifically, you need to explicitly set the path to include /usr/local/bin or the fping command won't be found. Add: PATH=3D/bin:/usr/bin:/usr/local/bin ; export PATH=20 up at the top of the script. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --mojUlQ0s9EVzWg2t Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+hb+sdtESqEQa7a0RApoXAJ9K/PMq1pxrVlGW793BpRE6YiT4yQCggYyg 3M3oCZSCTm694VEM8FYRgVk= =fLlE -----END PGP SIGNATURE----- --mojUlQ0s9EVzWg2t--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030329154548.GB33617>