Marc Powell <li...@xodus.org> writes: > On Oct 19, 2010, at 2:20 PM, steve f wrote: > >> Hello All, >> >> I have the following script created to check free space on a remote legacy >> box via rsh. >> >> used=`sudo rsh $1 df -v |grep starlite6 | head -1 | awk '{print $4}'` >> free=`sudo rsh $1 df -v |grep starlite6 | head -1 | awk '{print $5}'` > > Beyond just good programming practice, always use full paths to external > programs within your scripts. $PATH may not be what you expect it to be, > especially when being run by the nagios daemon which has a more restrictive > environment. > > # (paths may be different on your system) > used=`/usr/bin/sudo /usr/bin/rsh $1 /bin/df -v | /bin/grep starlite | > /usr/bin/head -1 | /usr/bin/awk '{print $4}'`
Or... set PATH before doing anything else, e.g. #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH [...rest of script...] This will enhance readability wrt. using full paths everywhere. Cheers, -- Trond H. Amundsen <t.h.amund...@usit.uio.no> Center for Information Technology Services, University of Oslo ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null