简体   繁体   中英

Running forever.js in a git bash script?

Inside my git hook post-receive file.

#!/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

Then when my project is ready to be committed git push live master which triggers the post-receive script above writes the new files but forever gives me an error.

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

Obviously the error is clear, but I am pretty confident the directory I gave is accurate, I think I need an alternate way of telling the script where the forever process server.js is located.

I have read https://github.com/foreverjs/forever maybe I am missing something here?

Try using the full path of 'forever'. In terminal run 'which forever' and use the path it gives you in your bash.

It would look something like this
full/path/forever restart ../../../www/example.io/public_html/server.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM