What isn't this crontab working?

I have a Mac running an Apache server, and I run a crontab every night at midnight that sets my Safari homepage to http://myipaddresshere/ (that is not a real link). I have a function in my .profile file called whatsmyip that printfs my ip address. Here it is:

whatsmyip(){
printf "`ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2`\n"
}

I use this function in my crontab so I can obtain my ip address and set that to my Safari home page. Here it is:

@daily Ethanal defaults write com.apple.Safari HomePage -string "http://`whatsmyip`/"; killall Safari; printf "=====`date`=====\nThe preferences were changed and your IP address is `whatsmyip`\n" >> /Users/Ethanal/Library/Logs/crontab.log

What this does is sets my Safari home page to my ip address so I don't have to do it manually every time the ip address changes, then writes a notification to a .log file I created called crontab.log. The only problem is, the homepage doesn't change, and the notification in the console file leaves out my ip address (like below).

=====Wed Sep 2 18:00:01 EDT 2009=====
The preferences were changed and your IP address is

Can someone help me figure out why this isn't working?

1 answer
Sep 3, 2009. 3:01 PMlemonie says:
Have you read the MAN page?

L

Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!