node.js - ForeverJS bash script errors on first line -
im trying foreverjs script run node server on ec2 instance. script looks like:
#!/bin/bash forever stopall forever hakuna-matata store in appropriate logs start 'full/qualified path'
even if add echo "getting here"
statement first line still error. not know bash scripting well, may permissions, relative/absolute path, ec2/node, environment variable related, not know.
stacktrace:
[ec2-user@12-34-56 folder]$ forever startup.sh warn: --minuptime not set. defaulting to: 1000ms warn: --spinsleeptime not set. script exit if not stay @ least 1000ms /home/user/var/www/folder/startup.sh:2 echo "gh" ^^^^ syntaxerror: unexpected string @ createscript (vm.js:74:10) @ object.runinthiscontext (vm.js:116:10) @ module._compile (module.js:533:28) @ object.module._extensions..js (module.js:580:10) @ module.load (module.js:503:32) @ trymoduleload (module.js:466:12) @ function.module._load (module.js:458:3) @ function.module.runmain (module.js:605:10) @ startup (bootstrap_node.js:158:16) @ bootstrap_node.js:575:3 error: forever detected script exited code: 1
i tried via running script via forever service script forever start startup.sh
, same error. i've launched parent direct , (qualified) path.
whoami - user forever - /usr/local/bin/forever npm - /usr/local/bin/npm sudo whomai - root sudo npm - /usr/bin/npm sudo forever - /usr/bin/forever node -v -v8.2.1 npm -v - 5.3.0
ask if need additional environmental information...
forever assumes script
js file can executed node.js you're trying run bash script instead, errors out since echo "getting here"
isn't valid js code.
to fix this, need use -c
command line option when running forever
. the docs:
-c command command execute (defaults node)
so in case, you'd set -c
/bin/bash
; this:
forever start [log options] -c /bin/bash path/to/your-shell-script.sh
Comments
Post a Comment