Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Fixed the post-receive PHP hook to redeploy the sinatra application.
Browse files Browse the repository at this point in the history
  • Loading branch information
msporny committed Apr 9, 2012
1 parent 83b50f9 commit fa8cfce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/utils/git.php
Expand Up @@ -3,12 +3,12 @@
// open the token file // open the token file
$tfile = fopen('remote-update-token.txt', 'r'); $tfile = fopen('remote-update-token.txt', 'r');


// Acquire the lock in a non-blocking manner
if($tfile == FALSE) if($tfile == FALSE)
{ {
echo 'ERROR: You must create a file called remote-update-token.txt and ' . echo 'ERROR: You must create a file called remote-update-token.txt and ' .
'place a secret token in that file. See the README for more information.'; 'place a secret token in that file. See the README for more information.';
} }
// Acquire the lock in a non-blocking manner
else if(flock($tfile, LOCK_EX | LOCK_NB)) else if(flock($tfile, LOCK_EX | LOCK_NB))
{ {
$token = trim(fgets($tfile)); $token = trim(fgets($tfile));
Expand All @@ -24,7 +24,7 @@
echo 'git update successful'; echo 'git update successful';


// Run post-update script // Run post-update script
system("./deploy/before_restart && ./deploy/restart"); system("./deploy/after_push");
// Sleep for 5 seconds to throttle the update rate to 12 per minute // Sleep for 5 seconds to throttle the update rate to 12 per minute
sleep(5); sleep(5);
} }
Expand Down

0 comments on commit fa8cfce

Please sign in to comment.