在我的git hook post-receive文件中。
#!/bin/sh
git --work-tree=/var/www/example.io/public_html --git-dir=/var/repo/example.git checkout -f
forever restart ../../../www/example.io/public_html/server.js
然后当我的项目准备好提交时git push live master
触发上面的post-receive
脚本写入新文件,但永远会给我一个错误。
remote: error: Error restarting process: ../../../www/example.io/public_html/server.js
remote: error: Cannot find forever process: ../../../www/example.io/public_html/server.js
显然错误很明显,但我非常有信心我提供的目录是准确的,我想我需要另一种方法告诉脚本永远进程server.js
所在的位置。
我看过https://github.com/foreverjs/forever也许我在这里遗漏了什么?
答案 0 :(得分:1)
尝试永远使用'的完整路径。在终端运行中永远'并使用它在你的bash中给你的路径。
看起来像这样
full / path / forever restart ../../../ www / example.io / public_html / server.js