m1guelpf / chatgpt-telegram

Run your own GPTChat Telegram bot, with a single command!
MIT License
3.9k stars 560 forks source link

how to make this prog run in background? #35

Closed imatrixme closed 1 year ago

imatrixme commented 1 year ago

fyi I have an arm vps, ubuntu 22.0. every time I use these two commands below, it will not response.

./chatgpt-telegram &

or

./chatgpt-telegram &>/dev/null &

but, if I just call this command below, it woks like a charm, but, I can't close my ssh session...

./chatgpt-telegram

pls help, thx

xmbhjQAQ commented 1 year ago

Could you upload the log?

NiallLDY commented 1 year ago

You can run it in Docker:

# Ubuntu 22.04
FROM ubuntu:22.04

# Working directory: /root
WORKDIR /root

RUN apt-get update && apt-get install -y wget

# Download file from 'https://github.com/m1guelpf/chatgpt-telegram/releases/download/v0.2/chatgpt-telegram-Linux-amd64.tar.gz'
RUN wget 'https://github.com/m1guelpf/chatgpt-telegram/releases/download/v0.2/chatgpt-telegram-Linux-amd64.tar.gz'

# Extract file
RUN tar -xvf chatgpt-telegram-Linux-amd64.tar.gz

# Mkdir /root/.config
RUN mkdir /root/.config

# Run chatgpt-telegram
CMD ./chatgpt-telegram

Then build & run:

docker build -t chatgpt-tg .
docker run -d --name chatgpt-tg --restart=always -v $PWD/.env:/root/.env -v $PWD/chatgpt.json:/root/.config/chatgpt.json chatgpt-tg:latest

Docker log:

docker logs -f chatgpt-tg
EricMeteorite commented 1 year ago

nohup ./chatgpt-telegram &

imatrixme commented 1 year ago

nohup ./chatgpt-telegram &

this line of command make the bot works well! thanks!

imatrixme commented 1 year ago

You can run it in Docker:


# Ubuntu 22.04

FROM ubuntu:22.04

# Working directory: /root

WORKDIR /root

RUN apt-get update && apt-get install -y wget

# Download file from 'https://github.com/m1guelpf/chatgpt-telegram/releases/download/v0.2/chatgpt-telegram-Linux-amd64.tar.gz'

RUN wget 'https://github.com/m1guelpf/chatgpt-telegram/releases/download/v0.2/chatgpt-telegram-Linux-amd64.tar.gz'

# Extract file

RUN tar -xvf chatgpt-telegram-Linux-amd64.tar.gz

# Mkdir /root/.config

RUN mkdir /root/.config

# Run chatgpt-telegram

CMD ./chatgpt-telegram

Then build & run:


docker build -t chatgpt-tg .

docker run -d --name chatgpt-tg --restart=always -v $PWD/.env:/root/.env -v $PWD/chatgpt.json:/root/.config/chatgpt.json chatgpt-tg:latest

Docker log:


docker logs -f chatgpt-tg

my vps cannt afford docker running 😮‍💨