Add this line inside the main
Options Includes ExecCGI
Restart apache and you are done!
mkdir -p /store/homes
root@hack:~# vi /etc/init.d/homesync
### 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
### END INIT INFO
case $MODE in
rsync -parv --inplace $TARGET /home/
rsync -parv --inplace --exclude-from=$EXCLUDE --delete /home/ $TARGET
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
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.
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
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.