[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] korganizer synchronization PDA <-> PC
From:       Mahnu Promayon <Emmanuel.Promayon () imag ! fr>
Date:       2002-08-29 12:50:02
[Download RAW message or body]

Hi,

I wrote a wuick syncrhonization script (in sh) between korganizer/embedded and 
korganizer on a pc.
I tested the script on an iPAQ, but it should work on the zaurus as well.

It uses scp to download/upload the korganizer ics file of the PDA, and a few 
dcop commands to do the merging business.
The script verify as well that korganizer is not running on the PDA (I got 
some pb if it is).
It should work with remote ics file (using URL).

I would be happy if this script helps.
If you think this script could be helpful, may be the korganizer webmaster 
could add it to the konqueror/embedded web site?

Please send me a mail if you found a bug!

Thanks to all the people who made this possible (especially Cornelius !)

Mahnu

PS/Carlos Vidal: maybe you could include this script in your package?

-- 
Emmanuel.Promayon@imag.fr      http://www-timc.imag.fr/Emmanuel.Promayon
Laboratoire TIMC-IMAG-CNRS UMR 5525, Université Joseph Fourier
Faculté de Médecine, Domaine de la Merci, 38706 La Tronche cedex, France
Tel: +33/0 476 54 95 98 - Fax: +33/0 476 54 95 55


["korganizer-sync" (application/x-shellscript)]

#!/bin/sh
#
# korganizer-sync
# v0.1
#
# Synchronizing korganizer/embedded with korganizer PC
#
# (c) Emmanuel Promayon, 2002
# Emmanuel.Promayon@imag.fr
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 1, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
# the GNU General Public License for more details.

# REQUIEREMENTS:
# - you should have korganizer and OpenSSH installed on both your PC and PDA
# - you should have /bin/pidof command installed on the PDA (by default it is)
# - you should have a dcop server up and running (that's the case by default 
#   if your are running kde)
# - It is better to have configure ssh to be passwordless (otherwise this script
#   will work but you will need to enter you password few times)
#   To do that, see http://handhelds.org/z/wiki/ssh passwordless authentication
#   (beware of the spaces between words), that is:
#   "To get this working on ipaq, you need to use the command ssh-keygen -t dsa, 
#    and end up with the files id_dsa and id_dsa.pub in your ~/.ssh directory.
#    Copy the id_dsa.pub to ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2 on 
#    the ipaq, and password-less logins should work fine.
#    David McNab"
#
# HOW TO USE IT:
# Simply modify some of the configuration variables below to feet your
# installation
# 
# HOW IT WORKS:
# 1. it verifes that there are no korganizer up and running on the PDA 
#    (otherwise it ask the user to exit it or if it want the script to kill it)
# 2. it uses scp to transfer the pda file on the pc
# 3. it uses dcop command to merge the pc file with the pda file
# 4. it uses scp to transfer back the file to the pda
#
# Everything is very simple thanks to the great work of KDE team, KDE DCOP team
# and of course Preston Brown and Cornelius Schumarcher. the korganizer team

# Configuration, change what you want here:
# PDA hostname you are connected too
PDA_NAME="192.168.1.101" # or "ipaq" or "zaurus" or...
# where will the korganizer/embedded file be copied on your PC
# Note: you could use an URL if you don't want to put the pda's calendar
# on the local PC, that's not a problem at all for korganizer!
PDA_COPY="$HOME/Documents/ipaq_agenda.ics"
# where is the agenda 
# Note: you could use an URL if your main calendar is not
# on the local PC, that's not a problem at all for korganizer!
MAIN_CALENDAR="$HOME/Documents/agenda.ics"

# -----------------------------------
# Below this line, you should not have to modify this script
# to make it work. Enjoy!
# Name and home dir of the user to connect to on the pda (default installation = root)
PDA_USER="root"
PDA_HOME_DIR="/root"
PDA_URL="$PDA_USER@$PDA_NAME"
PDA_FILE_URL="$PDA_USER@$PDA_NAME:$PDA_HOME_DIR/Applications/korganizer/mycalendar.ics"

echo "Starting verification..."

# check if there are a korganizer running
kopid=`ssh $PDA_URL /bin/pidof korganizer`
if [ "$kopid" != "" ]; then
	echo "Can't synchronize: korganizer is running on the ipaq."
	echo "Your choices are to exit korganizer now..."
	echo "...or let me kill it for you (becareful, that means loss of data)"
	echo Should I try to kill it now?;	read confirm
	case "$confirm" in
		y*|Y*)
			ssh $PDA_URL killall korganizer
			;;
# *)
#	echo "Exit korganizer on the ipaq and run this shell again"
#	exit
#	;;
	esac
fi
# we gave a chance to the user to exit korganizer, check the user took it!
kopid=`ssh $PDA_URL /bin/pidof korganizer`
if [ "$kopid" != "" ]; then
	echo "When you are ready, run $0 again"
	exit
fi

echo "Starting the file transfer..."
scp $PDA_FILE_URL $PDA_COPY 

kopid=`/sbin/pidof korganizer`
if [ -z "$kopid" ]; then
       echo "Starting korganizer..."
       korganizer &
       sleep 1
fi

echo "Starting synchronization..."
dcop korganizer KOrganizerIface closeURL
dcop korganizer KOrganizerIface openURL $MAIN_CALENDAR
dcop korganizer KOrganizerIface mergeURL $PDA_COPY
dcop korganizer KOrganizerIface saveURL
scp $MAIN_CALENDAR $PDA_FILE_URL

echo "Done."

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic