vi /etc/apache2/sites-enabled/000-default
Add this line inside the main
VirtualHost *:80
section;Options Includes ExecCGI
Restart apache and you are done!
vi /etc/apache2/sites-enabled/000-default
VirtualHost *:80
section;Options Includes ExecCGI
rsync -parv --inplace -e "ssh -p 2222" $source $dest
sudo -i
mkdir -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/homesync
touch /root/excludes.rsync
WARNING: 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 stop
Note: 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.