Closed its-ogawa closed 3 years ago
Running npm run in the background should work, for example like the one mentioned here: https://medium.com/idomongodb/how-to-npm-run-start-at-the-background-%EF%B8%8F-64ddda7c1f1
Any error message?
Thank you for your advice.
I do not see any error messages.
When I run the command, it appears to work.
There is also just the following in nohup.out
.
$ cat nohup.out
> elasticsearch-head@0.0.0 start /usr/local/elastic/elasticsearch-head
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
However, it loses its effect when you close the terminal.
If you access elasticsearch-head from a browser, you will see ERR_CONNECTION_REFUSED
.
Does elasticsearch-head not support the nohup
command?
Should I get PM2
as the URL says?
I tried to install pm2
, but it didn't work.
wanted {"os": "darwin", "arch": "any"} (current: {"os": "linux", "arch": "x64"})
It looks like it has to be darwin
, but I'm using centos7
.
Is there any other better way?
@philipskokoh Do you have any better ideas?
I'll leave a note of the error I got when I installed pm2
just in case.
$ npm install pm2 -g
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/bin/pm2-docker -> /usr/lib/node_modules/pm2/bin/pm2-docker
/usr/bin/pm2-runtime -> /usr/lib/node_modules/pm2/bin/pm2-runtime
/usr/lib
mqw pm2@5.1.0
tqw @pm2/agent@2.0.0
x tqq UNMET PEER DEPENDENCY bufferutil@^4.0.1
x tqq fast-json-patch@3.0.0-1
x tqw nssocket@0.6.0
x x tqq eventemitter2@0.4.14
x x mqq lazy@1.0.11
x tqw proxy-agent@4.0.1
x x tqq agent-base@6.0.2
x x tqw http-proxy-agent@4.0.1
x x x mqq @tootallnate/once@1.1.2
x x tqq https-proxy-agent@5.0.0
x x tqw lru-cache@5.1.1
x x x mqq yallist@3.1.1
x x tqw pac-proxy-agent@4.1.0
x x x tqw get-uri@3.0.2
x x x x tqq data-uri-to-buffer@3.0.1
x x x x tqq file-uri-to-path@2.0.0
x x x x tqw fs-extra@8.1.0
x x x x x tqq graceful-fs@4.2.6
x x x x x tqq jsonfile@4.0.0
x x x x x mqq universalify@0.1.2
x x x x mqw ftp@0.3.10
x x x x tqw readable-stream@1.1.14
x x x x x tqq core-util-is@1.0.2
x x x x x tqq isarray@0.0.1
x x x x x mqq string_decoder@0.10.31
x x x x mqq xregexp@2.0.0
x x x tqw pac-resolver@4.2.0
x x x x tqw degenerator@2.2.0
x x x x x tqw ast-types@0.13.4
x x x x x x mqq tslib@2.3.0
x x x x x tqw escodegen@1.14.3
x x x x x x tqq estraverse@4.3.0
x x x x x x tqq esutils@2.0.3
x x x x x x mqw optionator@0.8.3
x x x x x x tqq deep-is@0.1.3
x x x x x x tqq fast-levenshtein@2.0.6
x x x x x x tqq levn@0.3.0
x x x x x x tqq prelude-ls@1.1.2
x x x x x x tqq type-check@0.3.2
x x x x x x mqq word-wrap@1.2.3
x x x x x mqq esprima@4.0.1
x x x x tqq ip@1.1.5
x x x x mqq netmask@2.0.2
x x x mqw raw-body@2.4.1
x x x tqq bytes@3.1.0
x x x tqw http-errors@1.7.3
x x x x tqq depd@1.1.2
x x x x tqq setprototypeof@1.1.1
x x x x tqq statuses@1.5.0
x x x x mqq toidentifier@1.0.0
x x x mqq unpipe@1.0.0
x x tqq proxy-from-env@1.1.0
x x mqw socks-proxy-agent@5.0.1
x x mqw socks@2.6.1
x x mqq smart-buffer@4.1.0
x tqq semver@7.2.3
x tqq UNMET PEER DEPENDENCY utf-8-validate@^5.0.2
x mqq ws@7.4.6
tqw @pm2/io@5.0.0
x tqw @opencensus/core@0.0.9
x x tqw continuation-local-storage@3.2.1
x x x tqw async-listener@0.6.10
x x x x mqq semver@5.7.1
x x x mqq emitter-listener@1.1.2
x x tqq log-driver@1.2.7
x x tqq semver@5.7.1
x x mqq uuid@3.4.0
x tqw @opencensus/propagation-b3@0.0.8
x x mqw @opencensus/core@0.0.8
x x mqq semver@5.7.1
x tqw async@2.6.3
x x mqq lodash@4.17.21
x tqq eventemitter2@6.4.4
x tqw require-in-the-middle@5.1.0
x x tqq module-details-from-path@1.0.3
x x mqw resolve@1.20.0
x x tqw is-core-module@2.4.0
x x x mqw has@1.0.3
x x x mqq function-bind@1.1.1
x x mqq path-parse@1.0.7
x tqq semver@6.3.0
x tqq shimmer@1.2.1
x tqq signal-exit@3.0.3
x mqq tslib@1.9.3
tqw @pm2/js-api@0.6.7
x tqq async@2.6.3
x tqw axios@0.21.1
x x mqq follow-redirects@1.14.1
x tqq UNMET PEER DEPENDENCY bufferutil@^4.0.1
x tqq eventemitter2@6.4.4
x mqq UNMET PEER DEPENDENCY utf-8-validate@^5.0.2
tqq @pm2/pm2-version-check@1.0.4
tqq async@3.2.0
tqq blessed@0.1.81
tqw chalk@3.0.0
x tqw ansi-styles@4.3.0
x x mqw color-convert@2.0.1
x x mqq color-name@1.1.4
x mqw supports-color@7.2.0
x mqq has-flag@4.0.0
tqw chokidar@3.5.2
x tqw anymatch@3.1.2
x x mqq picomatch@2.3.0
x tqw braces@3.0.2
x x mqw fill-range@7.0.1
x x mqw to-regex-range@5.0.1
x x mqq is-number@7.0.0
x tqq glob-parent@5.1.2
x tqw is-binary-path@2.1.0
x x mqq binary-extensions@2.2.0
x tqw is-glob@4.0.1
x x mqq is-extglob@2.1.1
x tqq normalize-path@3.0.0
x mqq readdirp@3.6.0
tqq cli-tableau@2.0.1
tqq commander@2.15.1
tqw cron@1.8.2
x mqw moment-timezone@0.5.33
x mqq moment@2.29.1
tqq dayjs@1.8.36
tqw debug@4.3.1
x mqq ms@2.1.2
tqw enquirer@2.3.6
x mqq ansi-colors@4.1.1
tqq eventemitter2@5.0.1
tqw fast-printf@1.6.5
x mqq boolean@3.1.2
tqq fclone@1.0.11
tqq mkdirp@1.0.4
tqw needle@2.4.0
x tqq debug@3.2.7
x tqw iconv-lite@0.4.24
x x mqq safer-buffer@2.1.2
x mqq sax@1.2.4
tqw pidusage@2.0.21
x mqq safe-buffer@5.2.1
tqw pm2-axon@4.0.1
x tqq amp@0.3.1
x tqq amp-message@0.1.2
x mqq escape-string-regexp@4.0.0
tqq pm2-axon-rpc@0.7.1
tqw pm2-deploy@1.0.2
x tqq run-series@1.1.9
x mqq tv4@1.3.0
tqw pm2-multimeter@0.1.2
x mqq charm@0.1.2
tqw pm2-sysmonit@1.2.8
x tqq systeminformation@5.7.7
x mqw tx2@1.0.4
x mqq json-stringify-safe@5.0.1
tqw promptly@2.2.0
x mqw read@1.0.7
x mqq mute-stream@0.0.8
tqw semver@7.3.5
x mqw lru-cache@6.0.0
x mqq yallist@4.0.0
tqw source-map-support@0.5.19
x tqq buffer-from@1.1.1
x mqq source-map@0.6.1
tqw vizion@2.2.1
x tqq async@2.6.3
x tqq git-node-fs@1.0.0
x tqq ini@1.3.8
x mqw js-git@0.7.8
x tqq bodec@0.1.0
x tqq culvert@0.1.2
x tqq git-sha1@0.1.2
x mqq pako@0.2.9
mqw yamljs@0.3.0
tqw argparse@1.0.10
x mqq sprintf-js@1.0.3
mqw glob@7.1.7
tqq fs.realpath@1.0.0
tqw inflight@1.0.6
x mqq wrappy@1.0.2
tqq inherits@2.0.4
tqw minimatch@3.0.4
x mqw brace-expansion@1.1.11
x tqq balanced-match@1.0.2
x mqq concat-map@0.0.1
tqq once@1.4.0
mqq path-is-absolute@1.0.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN ws@7.4.6 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.4.6 requires a peer of utf-8-validate@^5.0.2 but none was installed.
I created the following Unit definition file and decided to start it with `systemctl
Here is the procedure for your reference.
create a Unit definition file
$ cat /etc/systemd/system/elasticsearch-head.service
Unit]
Description = elasticsearch-head
Service]
WorkingDirectory=/usr/local/elastic/elasticsearch-head
ExecStart = /usr/bin/npm start
Restart = always
Type = simple
[Install] WantedBy = multi-user.target
WantedBy = multi-user.target
Activate the service
$ systemctl enable elasticsearch-head
$ systemctl list-unit-files --type=service | grep elasticsearch-head
elasticsearch-head.service enabled
Start the service
$ systemctl start elasticsearch-head
Have a good ElasticSearch-Head life!
Good that you solve your problem. Sorry, cannot help much on it since I do not encounter the same issue.
@philipskokoh Thank you for commenting.
It may be a very rare case. Still, I hope it can help someone who has faced a similar problem.
I've cloned git and installed elasticsearch-head.
I've been running it in the background while the terminal is running, but I want to keep it running after I close the terminal.
I ran the following command, but when I close the terminal, I cannot access elasticsearch-head from my browser.
Is there any better way to do this?