Wednesday, February 22, 2012

Setup your own Dropbox with Unison

Using Unison in Linux

This does seem to work pretty well. I haven't set it up as a service anywhere, so I have to run it from the command prompt. But, once it gets going, it is quick.

Install Unison on two computers (server and client); uses ssh, so that needs to be installed, too. The version of Unison on both computers must be the same.

http://www.seas.upenn.edu/~bcpierce/unison//download/releases/

Intall OCaml (http://caml.inria.fr/)
sudo yum install ctags-etags ocaml
cd to the unison source directory, then:
make UISTYLE=text
./unison -version
mv unison ~
cd ~
mv unison .unison/
 
Now that the code has been run, the .unison/default.prf has been created; edit (on the client):
# load the common preferences
include common
addprefsto = common
label = default profile
#root = source
#root = /home/username/Desktop/Unison

#root = source2
#root = source2
#root = ssh://login@host.com/Desktop/Unison
#root = ssh://login@host.com/Desktop/Unison

#path = path to sync
#ignore = path to NOT sync

Also on the client, in your home directory, create the .unison/common file:
# Unison preferences fileauto=truebatch=truesshargs = -Ccopythreshold = 1000killserver = truecopyquoterem = trueconfirmbigdel = falsemaxthreads = 5perms=0times=truesilent = true#group=true#owner=trueprefer=newer#crontab -e#*/30 * * * * /usr/bin/unison <profile> &> /dev/null
Use the default.prf file as a template to create a file for your needs (ie "backup.prf"):
# Unison preferences
include common
label = my backup
root = /home/username-on-client
root = ssh://username@domain//media/path/to/destination
path = Name-Of-Directory
This is the commandline I use on the client:
unison backup -auto -ui text
If it isn't working, create a logfile:
unison backup -auto -ui text -logfile unison.log
Once you're happy with it, create a cron job (crontab -e):

*/30 * * * * /path/to/unison backup &>/dev/null
(Don't forget to restart the crond daemon: service crond restart)

You can also use incrond / inotify to call the script on filesystem changes (as opposed to time-based cronjobs.)

[Windows version available here: http://alan.petitepomme.net/unison/index.html]

FYI, to transfer within the same system:
unision -batch <source> <dest>

Advanced Unison Settings

Turn Bluetooth and Wi-Fi on/off automatically in Cyanogenmod 7

Hard little gem to find. If there's another way to do it, I couldn't find it.
Create a Power Control widget, and change the Power Events settings at the bottom of the settings screen.  You can set Bluetooth and Wi-Fi to enable/disable automatically when the charger is connected/disconnected.  (Several other settings are available here, as well, but these are the only ones I was looking for at the moment...)

You do have to save the widget, but you don't have to actually KEEP it, by the way. Deleting the widget from your homescreen doesn't disable these settings.

Monday, February 20, 2012

Dropbox on Fedora 16 Headless

(Some of this came from wiki.dropbox, but I can't find it there anymore...)

AS A USER, NOT ROOT, ssh to the server (without X11 forwarding), then:
echo DROPBOX_USERS="<insert user name here>" > /etc/sysconfig/dropbox.conf 
Fix file permissions: 
chmod 0644 /etc/sysconfig/dropbox.conf 
IN USER'S HOME: 
wget http://www.dropbox.com/download/?plat=lnx.x86_64 
Extract:
tar -xzvf dropbox*.tar.gz cd .dropbox-dist ./dropboxd # DO NOT HAVE X11 FORWARDING ENABLED when you run dropboxd
The first time it is run, it will ask you to visit a link to activate; copy the URL and visit in a browser on your desktop (doesn’t have to be on the server.) Once activated, in the terminal: 
^C to close dropboxd 
cd /lib/systemd/system 
Edit dropbox.service, and insert the followingUPDATED 3/31/2012
[Unit]Description=Dropbox
DaemonAfter=syslog.target network.target nmb.service
[Service]
Type=forking
#PIDFile=/var/run/dropbox.pid
EnvironmentFile=/etc/sysconfig/dropbox.conf
ExecStart=/sbin/runuser -l <USER> -c "~<USER>/.dropbox-dist/dropboxd&"
[Install]
WantedBy=multi-user.target
Enable the service for autostart and start the Dropbox service:
systemctl enable dropbox.servicesystemctl --system daemon-reloadsystemctl status dropbox.service
systemctl start dropbox.servicesystemctl status dropbox.service
To disable the service:
systemctl stop dropbox.servicesystemctl disable dropbox.service

Connecting an Android phone to restricted.utexas WiFi

EAP method: PEAP
Phase 2 authentication: MSCHAPV2
Identity: Your EID
Anonymous Identity: anonymous (Believe it or not, this matters!)
Password: Your EID Password