[Ilugc] difference between interactive and background cron script

  • From: mohan.tux@xxxxxxxxx (Mohan Sundaram)
  • Date: Thu Oct 9 17:16:38 2008

I've written a bash script to get my SSID and accordingly set my network
preferences (on a Mac). The script works well in an interactive shell but
fails to work similarly when invoked thro cron.
ssid = `networksetup -getairportnetwork| cut -d : -f 2`
echo $ssid ESSID found.

gives me the SSID of my access point. Output is
MOHAN-DSL ESSID found.

script contents:
ssid = `networksetup -getairportnetwork| cut -d : -f 2`
echo $ssid ESSID found.

is invoked using */3 * * * * script > logfile in crontab. cat logfile shows
just
ESSID found.

Any pointers?

Mohan

Other related posts: