Bash – crontab ifconfig outputting nothing

bashcron

/home/myname/bin/script:

#!/bin/bash
ifconfig > /home/myname/foo

Crontab:

* * * * * /home/myname/bin/script

…waits 1 minute…

@@ 11:35:51 [myname@comp - ~]$ ls foo
-rw-r--r-- 1 myname myname 0 Jul  7 11:35 foo
@@ 11:35:55 [myname@comp - ~]$ 

I can't figure out why foo would end up empty. Running the ifconfig command on the command line works exactly as you'd expect, dumping its output into a file just like normal. For reference, I'm running Ubuntu 8.04.

Best Answer

try using the full path to the ifconfig executable in your script.

which ifconfig will give you the path.

I don't know what ipconfig does in ubuntu. :)