vi /etc/apache2/sites-enabled/000-defaultAdd this line inside the main
VirtualHost *:80 section;Options Includes ExecCGIRestart apache and you are done!
vi /etc/apache2/sites-enabled/000-defaultVirtualHost *:80 section;Options Includes ExecCGIrsync -parv --inplace -e "ssh -p 2222" $source $dest
sudo -imkdir -p /store/homes
root@hack:~# vi /etc/init.d/homesync
#!/bin/sh
### BEGIN INIT INFO
# Provides: homesync
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: sync homes at startup and shutdown
# Description:
### END INIT INFO
MODE=$1
TARGET="root@zen:/store/homes/"
EXCLUDE="/root/excludes.rsync"
case $MODE in
start)
rsync -parv --inplace $TARGET /home/
;;
stop)
rsync -parv --inplace --exclude-from=$EXCLUDE --delete /home/ $TARGET
;;
esac
Note: Of course you need to change TARGET= to suit your own environment. Also, if your SSH server is listening on a non standard port you will need to modify the rsync command as per this post
chmod +x /etc/init.d/homesynctouch /root/excludes.rsyncWARNING: If this is not the first (ie primary) client that you are setting this up on then don't run the following command as is or else it will wipe out the "backup" that is already on the server. In such a case you need to replace the "stop" in the command with "start" in order to retrieve the primary files from the server instead.
/etc/init.d/homesync stopNote: Depending on how much stuff you have in your user homes this may take some time. You should also ensure that you have enough space to fit everything!
sudo update-rc.d -f homesync defaults
Junk*
oops*
.pulse*
.cache*
tmp*
temp*
gvfs*
.gvfs*
.Trash*
Trash*
*~
Thumbs.db*
desktop.ini*
lost+found*
DISCLAIMER: Be very careful using this setup in a multiuser environment where there is more than one PC (in use) at any one time. If a user is logged in on more than one PC then it is possible that they could lose data. Be sure you understand the limitations of this system before proceeding down such a path. Also note that the script only executes at startup and shutdown so if the PC is rarely restarted then this system will be of little value. I recommend using it for a simple home network only. It is not flexible or robust enough for use in a corporate network. And one final note, this does not work if you connect to the server using a wifi connection due to the way Ubuntu connects and disconnects after the user logs in. Any script such as this one that runs at boot time will not be able to connect to the network in order to do the sync. In such scenarios you could consider using a cron job or syncing manually.
cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fillvmware-vdiskmanager -k sda.vmdkudevadm trigger is not permitted while udev is unconfiguredsudo fdisk -lDisk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d730c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 994 7977984 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 994 1045 407553 5 Extended
/dev/sda5 994 1045 407552 82 Linux swap / Solaris mkdir tmprootsudo mount /dev/sda1 /home/ubuntu/tmprootsudo chroot /home/ubuntu/tmprootls /boot abi-2.6.32-21-generic-pae memtest86+.bin
abi-2.6.32-24-generic-pae System.map-2.6.32-21-generic-pae
System.map-2.6.32-22-generic-pae config-2.6.32-21-generic-pae
System.map-2.6.32-24-generic-pae config-2.6.32-22-generic-pae
config-2.6.32-24-generic-pae vmcoreinfo-2.6.32-21-generic-pae
vmcoreinfo-2.6.32-24-generic-pae grub
initrd.img-2.6.32-21-generic-pae vmlinuz-2.6.32-21-generic-pae
initrd.img-2.6.32-22-generic-pae vmlinuz-2.6.32-22-generic-pae
initrd.img-2.6.32-24-generic-pae vmlinuz-2.6.32-24-generic-paesudo update-initramfs -u -k 2.6.32-24-generic-paesudo dpkg -i sudo dpkg -i plowshare_0.9.3-1_all.debsudo apt-get install -fplowdown http://rs215.rapidshare.com/files/314956608/ubuntu-9.10-dvd-i386.iso.part01.rarchroot /mnt/sysimagecd /bootWe need to take note of the kernel version that we will be making an image for, it will usually be the latest version. In my case it was 2.6.18-53.el5PAE We will be using this info later. Just do an ls of the directory to see all the installed images. mv initrd-2.6.18-53.el5PAE.img initrd-2.6.18-53.el5PAE.img.backupmkinitrd /boot/initrd-2.6.18-92.el5.img 2.6.18-53.el5PAEgrub-install /dev/sdaIf your drive is on /dev/hda or something else entirely then substitute the correct value in the command above.
exit