L
L
lavrik_andrey2021-04-24 12:12:53
Command line
lavrik_andrey, 2021-04-24 12:12:53

How to run node js server via ssh?

Hello

, I'm trying to make a script that deploys a node js file to the server, stops the current process and restarts the node file

#!/bin/bash

echo "деплоим  index.js"
scp index.js [email protected]:~/tg_bot/
echo "остановка бота"
ssh [email protected] "pkill -f 'node index.js'"
echo "запуск бота"
ssh [email protected] "cd tg_bot && node index.js"

An error is thrown,
bash: node: command not found
how to run node index.js?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Vasilyev, 2021-04-24
@vasilyevmn

ssh [email protected] "pkill -f 'node index.js'"

ssh [email protected] 'pkill -HUP node'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question