On 17:16:16 Oct 09, Mohan Sundaram wrote: > 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? >
cron(8) cannot use STDIO, STDOUT or STDERR. All point to /dev/null. So it is AFAIK impossible to run interactive programs using cron. First check whether your script works in a batch fashion rather than interactive. Then you can get it working with cron. Of course you need to give full path for 'networksetup'. -Girish _______________________________________________ To unsubscribe, email [EMAIL PROTECTED] with "unsubscribe <password> <address>" in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
