Skip to content

Instantly share code, notes, and snippets.

@rextaylor
Forked from thatarchguy/webhook.php
Created October 16, 2015 02:06
Show Gist options
  • Save rextaylor/22c1163d3f90a1baf4c7 to your computer and use it in GitHub Desktop.
Save rextaylor/22c1163d3f90a1baf4c7 to your computer and use it in GitHub Desktop.
Cpanel deploy.php script
<?php
/**
* GIT DEPLOYMENT SCRIPT
*
* Used for automatically deploying websites via github or bitbucket, more deets here:
*
* https://gist.github.com/1809044
*
* Edited for Cpanel use
*/
// The commands
$commands = array(
'echo $PWD',
'whoami',
'uname -ra',
'/usr/local/cpanel/3rdparty/bin/git --version',
'/usr/local/cpanel/3rdparty/bin/git pull',
'/usr/local/cpanel/3rdparty/bin/git status',
'/usr/local/cpanel/3rdparty/bin/git submodule sync',
'/usr/local/cpanel/3rdparty/bin/git submodule update',
'/usr/local/cpanel/3rdparty/bin/git submodule status',
);
// Run the commands for output
$output = '';
foreach($commands AS $command){
// Run it
$tmp = exec($command);
// Output
$output .= "<span style=\"color: #6BE234;\">\$</span> <span style=\"color: #729FCF;\">{$command}\n</span>";
$output .= htmlentities(trim($tmp)) . "\n";
}
// Make it pretty for manual user access (and why not?)
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>GIT DEPLOYMENT SCRIPT</title>
</head>
<body style="background-color: #000000; color: #FFFFFF; font-weight: bold; padding: 0 10px;">
<pre>
. ____ . ____________________________
|/ \| | |
[| <span style="color: #FF0000;">&hearts; &hearts;</span> |] | Git Deployment Script v0.1 |
|___==___| / &copy; oodavid 2012 |
|____________________________|
<?php echo $output; ?>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment