dongzi3805 2016-09-15 15:16
浏览 65

Git Hook PHP脚本:没有输出

I have this Script php-pull-script.phpwritten:

<?php
  $output1 = shell_exec('git pull');
  $output2 = shell_exec('pkill java');
  $output3 = shell_exec('mvn package');
  $output4 = shell_exec('java -jar ./target/compute-0.0.1-SNAPSHOT.jar');

  echo "<pre>$output1</pre>";
  echo "<pre>$output2</pre>";
  echo "<pre>$output3</pre>";
  echo "<pre>$output4</pre>";
?>

When executing in shell, I am not seeing any output in order to verify that it is running. I am not sure at all it is working. Is there a better way to do this automation script?

  • 写回答

2条回答 默认 最新

  • dongyoucha0645 2016-09-15 15:25
    关注

    You might not be in the correct working directory. You may need to set that manually to make the commands run. Otherwise, those commands look right. Though you really should just have this set up as a shell script. PHP's not a good language for this sort of thing, and if you are calling this from a REST endpoint there are far better solutions like Jenkins.

    评论

报告相同问题?