ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
管理web钩子 [http://106.12.109.149:9090/svn\_update.php?repos=gyzl&rev=11](http://gogs.16u.top/linjinkun/gyzl/settings/hooks/1) ``` (1)代码部分 添加文件svn_update.php #! /usr/bin/php <?php error_reporting(0); header("Cache-Control:no-cache,must-revalidate"); $rev = intval(trim($_REQUEST['rev'])); $repos = trim($_REQUEST['repos']); $dir = dirname(__FILE__) . '/'; $file = $dir . 'svn_update_' . str_replace('.', '_', $repos) . '.sh'; if ( ! file_exists($file) ) { $file = $dir . 'svn_update.sh'; } $cmd = $file . ' ' . $repos . ' ' . $rev; print($cmd);echo "<br/>"; echo "Begin git update: >>><br/><br/> " . $cmd; $rs = exec($cmd . ' > /dev/null 2>&1 &',$result,$status); echo "<hr>"; var_dump($result,$status); ``` ``` (2)添加文件svn_update.sh #!/bin/bash echo "-----------------------------------------------" >> /home/www/localhost9090/shell.txt echo "hello I am shell " >> /home/www/localhost9090/shell.txt export LC_CTYPE="en_US.UTF-8" DATE=`date +%Y%m%d` TIME=`date "+%Y-%m-%d %H:%M:%S"` SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") PROJECT_REV=$2 PROJECT_NAME=$1 OP_LOG_FILE=${SCRIPTPATH}/logs/${PROJECT_NAME}_${DATE}.log PROJECT_DIR=/home/www/${PROJECT_NAME} echo "${PROJECT_NAME}" >> /home/www/localhost9090/shell.txt echo "${TIME}" >> /home/www/localhost9090/shell.txt #SVN_BIN=/usr/local/svn/bin/svn GIT_BIN=/usr/bin/git #SVN_PARAM=" up --non-interactive --no-auth-cache --username linjinkun --password abs1238222" if [ $PROJECT_NAME == "gyzl" ] then GIT_PARAM="pull origin master" echo >> $OP_LOG_FILE echo $TIME $PROJECT_REV >> $OP_LOG_FILE cd $PROJECT_DIR sudo $GIT_BIN $GIT_PARAM >> $OP_LOG_FILE 2>&1 #sudo git pull origin master >>/home/www/localhost9090/shell.txt 2>&1 if [ $? == 0 ] then echo "success" >>/home/www/localhost9090/shell.txt else echo "fail" >> /home/www/localhost9090/shell.txt fi sudo chown -R www:www $PROJECT_DIR echo "${PROJECT_DIR}" >> /home/www/localhost9090/shell.txt fi ```