We have 2 Ubuntu web servers, one of which is our staging server (Staging) and the other is our live server (Live). Staging has our Subversion repository, as well as the latest version of our sites on it. Because the SVN server is running on Staging, I've added post-commit hook scripts so that the staging server automatically has the latest code. Easy.

However, I'd like one of the repositories on Live to also stay updated. This is a repository of images, PDFs and suchlike. When a team member commits to this, I'd like it to automatically update on the live servers so it can be used in mailings, content managed pages etc.

I'd add something to the post-commit to SSH across and update, but for security, we can only SSH from one server to another as user 'commandLine', whereas the 'www-data' user runs the post-commit.

I'd rather not run a cron on Live to update every 5 minutes, but I can't see another way of doing it without altering all our user permissions.

Any ideas?


From my point of view, you already mentioned the straight-forward solutions

  • Let your commandLine user handle the svn repository on the live server
  • Alter your security restriction and let user www-data login from staging to live
  • Use a cron job

If none of this works for you, I could only imagine to SSH with user commandLine to the live server and create some kind of 'signal', e.g. create a file f. On the other hand, use a shell script with an endless loop as the signal's receiver (e.g., monitor whether f exists). The shell script would run under www-data's permissions and perform svn update every time the 'signal' is received.

Disclaimer: I'm not really a Unix expert, so I don't know what's the cleanest way to send the 'signal'. But I'm pretty sure there is a common solution for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.