[ale] OT: sync iPod with Sunbird Calendar (sortof)

Nathan J. Underwood ale1 at cybertechcafe.net
Wed Mar 23 13:57:39 EST 2005


Everyone,

	First, a couple of notes.  This is a work in progress, and isn't meant 
to be a be-all / end-all (basically, no flames please).  Second, it's 
OT, probably could get the 'very OT' stamp without too much of a 
stretch.  Third, it's (in it's current state) for a Windoze environment 
running cygwin, but it should be pretty easy to tweak it a bit so that 
it's usable on anything that'll run bash.
	Now, to the good stuff.  I recently (Sunday) broke down and bought an 
iPod.  After opening the box and tinkering with it a bit, I found that 
it supports iCal, so I was off to try to find a way to get it to sync 
with my Mozilla Calendar (plugin for the Firefox browser).  Suffice it 
to say, I didn't find much, so I started looking for a way to do it on 
my own, and came up with this little solution.

switch.bat -> simply a batch file telling it to run this in bash
update.sh -> a bash script that checks for the existence of a 
calendar.ics file, and backs it up (*moves it to calendar.ics.old), and 
then downloads (using wget & ftp) the calendar file from an ftp server.
	I realize that this is probably pretty elementary for most of the 
coding guru's out there, but it's pretty functional for me, and I 
thought maybe someone else could use it.

* move rather than copy because I'm using wget to download the actual 
calendar file, and wget doesn't want to overwrite the original

-- 
--
registered linux user # 73046
-------------- next part --------------
bash ./ipod_update.sh
-------------- next part --------------
#!/cygdrive/c/cygwin/bin/bash

#===========================
#  Setup some Variables
#===========================
CFILENAME='calendar.ics';   # Calendar file name (from current path)
FTPSVR='my.ftpserver.tld';      # FTP Server (fqdn to SERVER, not path)
FTPPATH='calendar';     # Path (from ftproot) to calendar file directory
FTPUNAME='username';    # Username for FTP server
FTPPASS='password';     # Password for FTP user

#===========================
# Get the necessary commands
#===========================
CP=$(which cp);    # copy
MV=$(which mv);      #
GET=$(which wget); # wget (this is how we will get the calendar file)


# Check for current calendar file
if [ -f $CFILENAME ]
    then
        if [ -f $CFILENAME.old ]
            then
            rm -rf $CFILENAME.old
        fi
    $MV $CFILENAME $CFILENAME.old
else
    echo "No previous calendar file found"
fi

# Now, download the file
$GET ftp://$FTPUNAME:$FTPPASS@$FTPSVR/$FTPPATH/$CFILENAME



More information about the Ale mailing list