Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. xluryan's Avatar
    Posts
    230 Posts
    Global Posts
    231 Global Posts
       #1  
    I just wanted to start a thread to show and share what's possible with a Linux box plus your Pre/Pixi. I'll start off with a little write-up on how to rsync your photos to your home computer...

    If you're like me, then you hate having to plug in your Pre just to grab some photos you took during the day. So this is how to make it so you can snap photos all day long, and when you get home, they'll be waiting for you already transferred to your computer.


    Prerequisites
    • Computer running Linux and rsync (I use Ubuntu, but anything will work)
    • Root access to phone (SSH required since that's what we're using to transfer photos)
    • Cron daemon enabled - instructions here


    The Setup
    1. Create a password-less SSH link
      SSH into your Pre and run the following commands
      Code:
      sudo -i
      # type your password, now you are root
      # stay logged in as root until you're done
      
      ssh-keygen -t rsa
      # press enter three times without entering anything
      
      cat /home/root/.ssh/id_rsa.pub
      # this will output the public key file. Copy the entire contents. It will start with 'ssh-rsa' and end with 'root@palm-webos-device'.
      Now log into your home computer under your normal username. Open a terminal and go to your home folder if you're not already. Now paste what you previously copied into a file named .ssh/authorized_keys.

      Once you've done that, go back to your SSH session on the Pre and just SSH into your home computer. It should do it automatically without asking for a password. That part is important.
    2. Install transfer script
      Simply copy this code and put it in /var/home/root/rs_photos.sh
      Code:
      #!/bin/sh
      
      img='/media/internal/DCIM/100PALM'
      rem='USER@YOURIP:/home/USER/Photos/'
      [ "$(ls -A $img)" ] || exit 1
      
      bat=$(grep BATTERY_IPC: /var/log/messages | tail -1 | awk '{print $9}' | sed 's/%,//')
      [ $bat -lt 30 ] && exit 2
      
      PATH=$PATH:/opt/bin/
      export PATH
      
      rsync -utz --ignore-existing --remove-source-files "$img"/* "$rem" || exit 3
      exit 0
      Save and exit the file, then run the following command to make it executable
      Code:
      chmod 700 rs_photos.sh
      Notes about the code:
      • Replace USER@YOURIP and USER with your username on your home computer and its IP address.
      • If you have a domain (highly recommended) use that instead of an IP.
      • Make sure you have a folder on your home computer named Photos under the /home/USER/ folder.
      • The part that reads [ $bat -lt 30 ] is making sure your battery is above 30 percent before it uploads anything. You can change this value however you want (between 1 and 94). 94 is useful if you only want your Pre to upload overnight while you charge it.
      • Once synchronizing is complete, the photos will be removed from your Pre. If you don't want this behavior, take out the --remove-source-files argument from the rsync command.
    3. Setup cron job
      While still SSH'd into your Pre, run the following command
      Code:
      vi /etc/cron/crontabs/root
      Then add this line at the bottom of the file
      Code:
      */10 * * * * /var/home/root/rs_photos.sh
      Now restart the cron daemon with the following two commands
      Code:
      initctl stop crond
      initctl start crond


    And you're done! Test this by taking a picture on your phone. At the next 10-minute mark your phone should start uploading it to your home computer
    Last edited by xluryan; 05/19/2010 at 02:29 PM.

  2. #2  
    Perfect timing, I just installed linux on my mac last night.
  3. xluryan's Avatar
    Posts
    230 Posts
    Global Posts
    231 Global Posts
       #3  
    Quote Originally Posted by berdinkerdickle View Post
    Perfect timing, I just installed linux on my mac last night.
    Now you're good to go! What flavor?

  4. #4  
    I was thinking about installing ubuntu, but I appear to be far too lazy
    "When there is no more room in hell, the dead will walk the earth"


    PM me your questions, If I cant find an answer, I'll show you who can.
  5. licotto's Avatar
    Posts
    471 Posts
    Global Posts
    510 Global Posts
    #5  
    I've started running ubuntu as of about a month ago! I love it!! It's nice to be released from Win7 (and all prev versions!) as well as from OSX!! (although i still need a good and EASY iWeb alternative!!)
  6. #6  
    Quote Originally Posted by mrloserpunk View Post
    I was thinking about installing ubuntu, but I appear to be far too lazy
    I installed Ubuntu on my WinXP machine a year ago, I was shocked at how easy it was and how it "worked right out of the box."

    I have it set up to dual boot to either WinXP or Ubuntu.

    I also just bought a Macbook Pro and I love the thing. My next desktop is going to be a Mac and I'll probably say goodbye to Windows forever.
  7. #7  
    Personally - I run my business on a Linux server in the office, Mac at sites and Pre on the road - using ZumoDrive to share critical files around all 3 of them.

    I could use rsync or just about any other low-level linux system to do file transfer...but I like something that just does it all seamlessly in the background when it needs to.
    Psion 3a, 3c, 3mx, Handspring Visor Deluxe, Treo 180, Treo 600, Centro, Pre, Touchpad, Pre3, Blackberry Passport (sorry!)
  8. #8  
    Thanks for the tips, OP! I have Ubuntu 9.10 as my only OS on my second laptop and I love it! So far I've only really used it for Meta Doctor and web browsing... I'm going to try your ideas later on tonight
  9. #9  
    Been running Debian (and later Ubuntu) for quite a bit now. I am running scripts that download or record podcasts and tv shows, convert them, and then transfer them to the phone overnight. I also send alerts to my phone when my power or internet drop, or when someone rings the doorbell. My phone also establishes a reverse ssh tunnel on boot, in case I lose it. This is in addition to the weekly automated backup that tar's /var, /opt, and /etc (as well as cat the hosts file from mvps.org with mine).
    -Joshua
    I've decided to become enigmatic.
  10. xluryan's Avatar
    Posts
    230 Posts
    Global Posts
    231 Global Posts
       #10  
    Quote Originally Posted by ****-richardson View Post
    Been running Debian (and later Ubuntu) for quite a bit now. I am running scripts that download or record podcasts and tv shows, convert them, and then transfer them to the phone overnight. I also send alerts to my phone when my power or internet drop, or when someone rings the doorbell. My phone also establishes a reverse ssh tunnel on boot, in case I lose it. This is in addition to the weekly automated backup that tar's /var, /opt, and /etc (as well as cat the hosts file from mvps.org with mine).
    Nice ideas Keep 'em coming!

  11. #11  
    xluryan,

    Great thread idea. I had looked in the Ubuntu forums before for a topic like this, but had never found anything. I like the rsync idea, now I'll have to try an come up with something as cool.
  12. #12  
    Quote Originally Posted by ****-richardson View Post
    Been running Debian (and later Ubuntu) for quite a bit now. I am running scripts that download or record podcasts and tv shows, convert them, and then transfer them to the phone overnight. I also send alerts to my phone when my power or internet drop, or when someone rings the doorbell. My phone also establishes a reverse ssh tunnel on boot, in case I lose it. This is in addition to the weekly automated backup that tar's /var, /opt, and /etc (as well as cat the hosts file from mvps.org with mine).
    Do you mind sharing how you send alerts for power, internet status and doorbell?
  13. philbw's Avatar
    Posts
    310 Posts
    Global Posts
    352 Global Posts
    #13  
    For the Windows users out there this is possible a few ways. You can either use the popular cygwin environment to use rsync "natively" in windows. Or if the system is really just for server purposes (like in my case mainly a Win7 Media Center setup) you could run a very lean debian (or other light flavor of linux) in a scaled back virtualbox instance and run rsync through that. Using guest services with virtualbox you could even back right up to a windows directory such as "Photos". Just some ideas.

    - Phil -
  14. #14  
    Quote Originally Posted by noco37 View Post
    Do you mind sharing how you send alerts for power, internet status and doorbell?
    Not at all. I send all alerts as a direct message from a twitter account for my house to my personal twitter acc't (I only get DM's via SMS).
    Power alerts are done via:
    Code:
    #/bin/bash
    
    while read -u 9 line; do
            cp /var/log/apcupsd.events ~/apcupsd.events.old
            curl -u "username:password" -d "status=d vauxje $line" "http://twitter.com/statuses/update.xml"
    done 9< <(comm -23 /var/log/apcupsd.events ~/apcupsd.events.old)
    Internet alerts are done on the machine my dreamhost site is hosted on - all you really need is a machine outside your network (preferably on a different ISP or even better in another state). Because the script is running on a machine that isn't directly under my control, I also send a daily alert every morning at 25 or 6 to 4 (little nod to Chicago) with a daily fortune to verify it's still running:
    Code:
    #!/bin/bash
    
    PNG="$(fping home.ipaddress.com 2>&1)"
    DTE="$(date +%D)"
    P_LOG="~/ping.txt"
    D_LOG="~/date.txt"
    
    Post() {
            USR="$1"; shift
            MSG="$@"
            curl -u "$USR" -d "status=$MSG" "http://twitter.com/statuses/update.xml"
    }
    
    if [ "$PNG" != "$(<$P_LOG)" ]; then
            echo $PNG > $P_LOG
            Post "username:password" "d vauxje $(date)" "$PNG"
    fi
    
    if [ "$DTE" != "$(<$D_LOG)" ]; then
            echo $DTE > $D_LOG
            sleep $((RANDOM % 2 + 94))m
            Post "username:password" "$(/usr/games/fortune -a -n 140 -s | tr '\n' ' ' | tr -d '\t' | tr \" \')"
            touch $D_LOG
    fi
    And doorbell alerts are done w/an arduino - there are instructions online, but I can post my solution if needed. The real difference between it and the scripts above is that the doorbell alert is run once at boot and is a while true loop with a 1 second sleep; the others are cron jobs run every minute.
    -Joshua
    I've decided to become enigmatic.
  15. #15  
    You guys are awesome..... I need to install Linux on more machines.... Right now just dual booting on an XP laptop.

    Quote Originally Posted by mrloserpunk View Post
    I was thinking about installing ubuntu, but I appear to be far too lazy
    DO IT!!!!! It's gotten so crazy easy to do, even if you need to partition a drive you are already using.
  16. kzz5's Avatar
    Posts
    8 Posts
    Global Posts
    14 Global Posts
    #16  
    I've completely switched to Fedora for the last 6-7 months. I'm interested to see what other awesome things people are doing with their pre and linux.
  17. #17  
    this is a great thread. it should be a sticky. i'm just learning linux - dual booting ubuntu with xp on a netbook. how did you guys learn the scripting? are there books or sites you'd recommend?

    thanks for the tips!
  18. #18  
    Quote Originally Posted by mrloserpunk View Post
    I was thinking about installing ubuntu, but I appear to be far too lazy
    Ubuntu is made for lazy people. I love it.
  19. xluryan's Avatar
    Posts
    230 Posts
    Global Posts
    231 Global Posts
       #19  
    Quote Originally Posted by 577359 View Post
    this is a great thread. it should be a sticky. i'm just learning linux - dual booting ubuntu with xp on a netbook. how did you guys learn the scripting? are there books or sites you'd recommend?

    thanks for the tips!
    Check this out: Advanced Bash-Scripting Guide.

  20. #20  
    Best thing to do is start using it for everday tasks, rather than the gui. Use it to install/remove software, launch apps, copy/move/delete files, etc.

    Scripting grows from the recognition that "I type this command quite a bit." So you shorten it, and later automate it. First script I recommend is a backup script - it's something most people aren't doing but should, and it introduces you to some of the core commands.
    -Joshua
    I've decided to become enigmatic.
Page 1 of 2 12 LastLast

Posting Permissions