[GH-ISSUE #145] Solution for those who have trouble starting peerflix-server with linux #122

Closed
opened 2026-02-25 20:32:28 +03:00 by kerem · 0 comments
Owner

Originally created by @leopedro95 on GitHub (May 23, 2018).
Original GitHub issue: https://github.com/asapach/peerflix-server/issues/145

I made a small script that can be useful for this function with the pgrep command.

Remember that the script is dependent on cron.

Attention: The script can be useful if you use server only for peerflix-server. Because it checks to see if node.js is running. If you have other processes with node.js can of the problem. But who wants to improve the script, feel free.

Let's put in the folder "/root":
nano checar-peerflix

Paste the code:

#!/bin/bash
#Script criado por: LPServidor
#Website: https://central.lpservidor.org

#--------------------------------------------------------#

#Verificar se o peerflix-server está rodando com o node.js

processo=$(pgrep "node")

if pgrep "node" > /dev/null
then
        echo "O node.js está sendo executado neste momento. Bem provalvel que o peerflix-server esteja funcionando!"
        echo "Número do processo: $processo"
else
        echo "Não foi detectado nenhum processo do node.js ativo, contudo o peerflix-server não está sendo executado. Tentando ligar...\n"
        /usr/bin/peerflix-server
fi

save and put in cron to run every 1 minute, use the command crontab -e:

* * * * * sh /root/checar-peerflix

Save again.

Done!

The script will check every 1 minute whether the node.js is running or not. If you will not try to connect peerflix-server.

Sorry for my English, because I did a free translation on google translator, because I speak Brazilian Portuguese.

Originally created by @leopedro95 on GitHub (May 23, 2018). Original GitHub issue: https://github.com/asapach/peerflix-server/issues/145 I made a small script that can be useful for this function with the `pgrep` command. Remember that the script is dependent on `cron`. Attention: The script can be useful if you use server only for **peerflix-server**. Because it checks to see if `node.js` is running. If you have other processes with `node.js` can of the problem. But who wants to improve the script, feel free. Let's put in the folder "/root": `nano checar-peerflix` Paste the code: ``` #!/bin/bash #Script criado por: LPServidor #Website: https://central.lpservidor.org #--------------------------------------------------------# #Verificar se o peerflix-server está rodando com o node.js processo=$(pgrep "node") if pgrep "node" > /dev/null then echo "O node.js está sendo executado neste momento. Bem provalvel que o peerflix-server esteja funcionando!" echo "Número do processo: $processo" else echo "Não foi detectado nenhum processo do node.js ativo, contudo o peerflix-server não está sendo executado. Tentando ligar...\n" /usr/bin/peerflix-server fi ``` save and put in cron to run every 1 minute, use the command `crontab -e`: `* * * * * sh /root/checar-peerflix` Save again. Done! The script will check every 1 minute whether the `node.js` is running or not. If you will not try to connect **peerflix-server**. Sorry for my English, because I did a free translation on google translator, because I speak Brazilian Portuguese.
kerem closed this issue 2026-02-25 20:32:28 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/peerflix-server#122
No description provided.