Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multi-User Palm Synchronising
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Cwiiis
n00b
n00b


Joined: 19 Feb 2004
Posts: 16

PostPosted: Thu Feb 26, 2004 4:54 am    Post subject: Multi-User Palm Synchronising Reply with quote

Multi-User Palm Synchronising

Summary

This document describes how to setup scripts to allow palm syncing for all the users of a system and to be able to customise the synchronisation process for each user. It is assumed that you have hotplug working correctly.

Directions

  • Create a file called '.hotsync' in the home directories of the users you want to allow to synchronise their palms. This file will be executed when the palm is synchronised, so put the relevant commands. For example, my ~/.hotsync reads:

    Code:

    #!/bin/bash

    # Loop through plucked docs and add them to install list
    # if they aren't already there

    for file in ~/Plucker/*.pdb
    do
            if ! cat ~/.jpilot/jpilot_to_install | grep "$file" > /dev/null
            then
                    echo $file >> ~/.jpilot/jpilot_to_install
            fi
    done

    # sync
    jpilot-sync

    # Delete plucked documents
    rm ~/Plucker/*.pdb


  • Change the permissions of these files so they're executable by their owner (e.g. 'chmod u+x ~/.hotsync')

  • Now we'll create the script that handles the synchronisation signal. This script scans the home directory (which is assumed to be at /home) and looks for the '.hotsync' file(s) we created earlier. It then checks if that user is logged in, and if it does, attempts to synchronise as that user, using that user's script. It will not try to synchronise more than one user at a time if two users are logged on. Here's the code:

    Code:

    #!/bin/bash

    for user in /home/*               # Scan each directory in /home
    do
       user=`basename $user`            # Get user name
       if [ -f "/home/$user/.hotsync" ]      # Check if hotsync file exists
       then
          if users | grep $user > /dev/null   # Check if user is logged on
          then
             su $user -c "~/.hotsync"   # Change to user and sync
             exit 0            # exit to avoid conflicts
          fi
       fi
    done


    Create this file as root and place this in a file called 'hotsync' somewhere in your path. I would recommend /usr/local/bin.

  • Change the permissions of the hotsync file you just created to be executable by its owner (root). (again, 'chmod u+x hotsync')

  • This last step is the easiest part. Assuming hotplug is setup correctly, create a file '/etc/hotplug/usb/visor' and make this file executable. In this file, put the full path of the hotsync script you created. Example:

    Code:

    root> cat /etc/hotplug/usb/visor
    /usr/local/bin/hotsync



Tip: If you have hotplug setup correctly, but it doesn't appear to be running /etc/hotplug/usb/visor, make sure that the visor/clie support is compiled as a module in the kernel. It will not work if it isn't.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum