Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: text/html; charset=utf-8");
- $js = json_decode($_POST["hook"], true);
- @error_log($_POST["hook"] . PHP_EOL, 3, 'hookInfo.log');
- if ($js->password == "yourConfigPassword") {
- $a = shell_exec( 'cd /data/www/yourGitProjectDir && sudo -u www /usr/bin/git pull 2>&1' );
- die("SUCCESS.");
- }
- else{
- die("ERROR.");
- }
- die("UNKNOW.");
- /**
- *sudo -u
- * if you run php-fpm use "www-data" user.
- * And pull project use "www" user.
- *
- *Change ProjectDir user:group :
- *
- * sudo chown -R www:www-data projectDir
- * then
- * sudo chmod -R g+s projectDir
- * 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
- *
- *
- * Edit sudo :
- *
- * www-data ALL=(www) NOPASSWD: /usr/bin/git
- *
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement