DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-10-10 20:37:04

bjby
Member
Registered: 2009-02-22
Posts: 265

Publish pictures from android phone to dns323 webserver in one click

Though I share a concept to upload photos from androidphone to dns323.

1. Install rsync for android. (https://market.android.com/details?id=e … nc4android)
2. Create keypair to make allow phone to sync SD card to dns323 sshd server, in one click.
3. Install a webserver e.g. lighttpd on dns323
4. Install some gallery generator.
5. Create a simple script which watches the disk for new uploads and generates picture galleries.

I have made a simple perl script which is run by cron every 15 min.

Code:

#!/usr/bin/perl
use strict;
use Fcntl qw(:flock SEEK_END);

open SELF, "< $0" or die ;
flock SELF, LOCK_EX | LOCK_NB  or exit;
 
genalbum(
        "/tmp/xperiadieyselj2323",
        "/tmp/xperiadieyse2323we",
        "/alicea/backup/xperia/sdcard/DCIM/100MSDCF/.",
        "/alicea/www/pages/Bilder/xperia/.",
        'bjorn.cusumcura@gmail.com');

genalbum(
        "/tmp/htcdieyselj232324",
        "/tmp/htcdieyse2323we234",
        "/alicea/backup/htc-wildfire/sdcard/DCIM/100MEDIA/.",
        "/alicea/www/pages/Bilder/htc/.",
        'cusumcura.cusumcura@gmail.com');

genalbum(
        "/tmp/canon-htcdieyselj232324",
        "/tmp/canon-htcdieqwse2ew23we234",
        "/alicea/backup/cannon-sx100/DCIM/100CANON/.",
        "/alicea/www/pages/Bilder/cannon-sx100/.",
        'bjorn.cusumcura@gmail.com');

        
sub genalbum{  
        my ($dfstate,$photostate,$photodir,$wwwdir,$toemail)=@_;
        #print "$dfstate , $photostate , $photodir , $wwwdir , $toemail \n";
        if ( ! -e $dfstate  ){  
                `df /alicea | md5sum > $dfstate`;       
        }

        if ( ! -e $photostate  ){  
                `find $photodir | md5sum > $photostate`;        
        }

        if ( `cat $dfstate` ne  `df /alicea | md5sum` && `cat $photostate` ne `find $photodir | md5sum` ){ 
                unlink ($photostate, $dfstate);          
                mkdir ($wwwdir);
                `rsync -av $photodir $wwwdir`;
                `cd $wwwdir;llgal  --sx 1000 --sy 600 --www`;
                `chmod -R 777 $wwwdir`;
                my $nowtime=localtime();
                `echo http://cusumcurakatt.dyndns.org/Bilder/  | mutt -s "cusumcurakatt picutures updated $nowtime" $toemail`;
        } 
}

Last edited by bjby (2011-10-10 20:54:02)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB