Advertisement
Guest User

Untitled

a guest
Aug 20th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. header("Content-type: text/html; charset=utf-8");
  4. $js = json_decode($_POST["hook"], true);
  5.  
  6. @error_log($_POST["hook"] . PHP_EOL, 3, 'hookInfo.log');
  7.  
  8. if ($js->password == "yourConfigPassword") {
  9. $a = shell_exec( 'cd /data/www/yourGitProjectDir && sudo -u www /usr/bin/git pull 2>&1' );
  10. die("SUCCESS.");
  11. }
  12. else{
  13. die("ERROR.");
  14. }
  15. die("UNKNOW.");
  16.  
  17. /**
  18. *sudo -u
  19. * if you run php-fpm use "www-data" user.
  20. * And pull project use "www" user.
  21. *
  22. *Change ProjectDir user:group :
  23. *
  24. * sudo chown -R www:www-data projectDir
  25. * then
  26. * sudo chmod -R g+s projectDir
  27. * First command changes owner and group Second command adds s attribute which will keep new files and directories within cake having the same group permissions
  28. *
  29. *
  30. * Edit sudo :
  31. *
  32. * www-data ALL=(www) NOPASSWD: /usr/bin/git
  33. *
  34. **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement