Date: Wed, 01 Oct 2008 09:53:08 -0400 From: Steve Bertrand <steve@ibctech.ca> To: "freebsd-questions@freebsd.org Questions -" <freebsd-questions@freebsd.org> Subject: Using global environment variables inside a subshell Message-ID: <48E380C4.4090304@ibctech.ca>
next in thread | raw e-mail | index | archive | help
Hi everyone, I've fudged together a quick disk space monitor that I will run from cron. Running the script works fine from the command line, but when I run it from cron, the environment variable is empty. Can someone point out the err of my ways?: #!/bin/sh /bin/df | \ /usr/bin/awk '{if($5 ~ "%" && $6 !~ "proc") {used=$5} else {used=""}; \ sub(/%/, "", used); \ if(used > 95) print $6 " is at " used"% on "ENVIRON["HOSTNAME"]"!"}' | \ mail -s "Disk usage action required" email@addr.com Cheers! Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48E380C4.4090304>