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

List:       kde-pim
Subject:    [Kde-pim] new version, korganizer synchronization PDA <-> PC
From:       Mahnu Promayon <Emmanuel.Promayon () imag ! fr>
Date:       2002-09-03 17:35:41
[Download RAW message or body]

In attachement the new version of a (sh) script to automatcially synchronize 
the korganizer calendar and todo list between a PDA and a PC.

This version does not need any user interaction and is safe (if korganizer is 
running on the PDA when the synchronizsation process begun, it does not 
brutaly kill the process as it was in the previous version posted last week, 
but it simply sends a qcop message to quit it, so that your PDA agenda is 
saved.

(see inside for instructions how to use it)

Feel free to contact me if there is any problem,

EP


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

#!/bin/sh
#
# korganizer-sync
# v0.3
#
# 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 servers up and running on both machines (that's the case \
by default  #   if your are running kde and opie or qtopia)
# - you should add the line "/opt/QtPalmtop/lib" in the /etc/ld.so.conf of the PDA
#   and then type ldconfig (to update the library path)
# - 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"
# - this script is using rsync by default to optimize the transfer, if you
#   don't have it on your PDA, just uncomment a line below
#
# 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
#
# v0.3 qcop call to exit if korganizer is running (instead of a brutal kill, so
#      that no data are lost)
#      do a copy of the ipaq file first before copying (just in case)
# v0.2 add automatic synchronization
# v0.1 get the file

# 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"

# if you have don't have rsync uncomment this line
RSYNC="rsync --rsh=ssh --perms --group --times --update --verbose"

# -----------------------------------
# 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 "korganizer is up and running... sending the quit() message to \
korganizer"  ssh $PDA_URL "export QTDIR=/opt/QtPalmtop && /opt/QtPalmtop/bin/qcop \
QPE/Application/korganizer 'quit()'" fi

echo "backing up the $PDA_FILE_URL to $PDA_COPY.bak"
scp $PDA_FILE_URL $PDA_COPY.bak

if [ "$RSYNC" != "" ]; then
	echo "Starting file transfer (using $RSYNC)..."
	$RSYNC $PDA_FILE_URL $PDA_COPY
else
	echo "Starting file transfer (using scp)..."
	scp $PDA_FILE_URL $PDA_COPY 
fi

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


if [ "$RSYNC" != "" ]; then
	echo "Transfering merged file to PDA (using $RSYNC)..."
	$RSYNC $MAIN_CALENDAR $PDA_FILE_URL
else
	echo "Transfering merged file to PDA (using scp)..."
	scp $MAIN_CALENDAR $PDA_FILE_URL
fi

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