R
Railway10mo ago
Alragi

Error running the application in the background.

I cannot or the screen -S command is not executed in my program, and I do not know what the solution is, knowing that the project does not work unless this procedure is implemented.
52 Replies
Percy
Percy10mo ago
Project ID: fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
Alragi
Alragi10mo ago
fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
MantisInABox
MantisInABox10mo ago
You won’t have access to the screen command in a container deployment. Your best bet would be to run the services separately from one another or use multi run and build your own Dockerfile for launching your service
Alragi
Alragi10mo ago
Can you guide me to create a Dockerfile? I will be grateful to you.
Brody
Brody10mo ago
you could also use parallel with nixpacks what are the two commands you want to run at the same time
Alragi
Alragi10mo ago
I did not understand you, sir, but I want to execute the screen -S command so that the application runs in the background. Did you understand me?
MantisInABox
MantisInABox10mo ago
Screen will not run in a docker container, you will need to either run multiple services or use parallel with nixpacks, or multi run inside of docker
josh
josh10mo ago
what kind of background process is it?
Alragi
Alragi10mo ago
Well, which service should I work and how? Because frankly, I don’t know about them. Can I provide you with the code so you can understand more?
Brody
Brody10mo ago
also tell us the commands you would run locally to get your project all up and running
josh
josh10mo ago
this would be good if you're running a backend web service and it's just a cronjob btw your best bet is probably celery, or whatever
Alragi
Alragi10mo ago
The commands to run the project are as follows: After entering the file path screen -S (file name) python3 main.py Then press Ctrl A and Ctrl D
Brody
Brody10mo ago
file name??
Alragi
Alragi10mo ago
This is how I access the file from a VPS, for example.
Brody
Brody10mo ago
yeah but what is the file you want to run in the background
josh
josh10mo ago
what exactly is your web service(s) supposed to do? it would make it much easier if we had a high-level view of what should happen instead of what you're doing at the moment
Alragi
Alragi10mo ago
import os from asyncio import create_task, create_subprocess_exec, subprocess, sleep from mody.Redis import db from mody.get_info import sudo_info from mody.mod import Bot async def auto_run(): while not await sleep(10): proc = await create_subprocess_exec( "screen", "-ls", stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) stdout, stderr = await proc.communicate() res = stdout.decode() for session in db.smembers(f'{Bot.me.id}:{sudo_info.id}:sessions'): if session[:50] not in res: os.system(f'screen -d -m -S {session[:50]} python3 users.py {session}') create_task(auto_run()) This is the full text of the code Bot Telegram Its name is users.py
Brody
Brody10mo ago
uh josh, you got this 🙂 have fun
josh
josh10mo ago
luckily i have experience with telegram bots lol
Brody
Brody10mo ago
me too, but i dont wanna open up that can of worms
Alragi
Alragi10mo ago
🙂♥thank you sir
josh
josh10mo ago
what exactly does the code do? is it supposed to maintain some kind of web connection?
Alragi
Alragi10mo ago
Why? Telegram bots are very interesting.
Brody
Brody10mo ago
i meant the can of worms as in that code you showed
Alragi
Alragi10mo ago
The truth is that I cannot tell you what it does because I am not proficient in the Python language, but I can provide you with the text of the code for the file users.py.
josh
josh10mo ago
yeah to be honest remote shell code execution is not reaaaaaaaaaally something that should be hosted on railway... but uh i don't represent railway so not my circus not my monkeys shrug but we should really find a way to not do that
Brody
Brody10mo ago
you are not wrong
Alragi
Alragi10mo ago
Be optimistic, my friend, do not disappoint me 😩
josh
josh10mo ago
ok can you paste the code
Alragi
Alragi10mo ago
Of course, give me a sec.
Alragi
Alragi10mo ago
Alragi
Alragi10mo ago
I think the code is too big, so I'll paste some of it
Brody
Brody10mo ago
how about you share your repo
Alragi
Alragi10mo ago
great. Project ID: fadd4c5c-74c0-4fd7-a209-03a8f7029c8d Or you mean from github?
Brody
Brody10mo ago
yes the github repo
Alragi
Alragi10mo ago
GitHub
GitHub - alragi0/tmwel
Contribute to alragi0/tmwel development by creating an account on GitHub.
Brody
Brody10mo ago
neither me, josh, vin work for railway, so neither of can do anything with the id
Alragi
Alragi10mo ago
Did you get what you wanted?
Brody
Brody10mo ago
this is looking a lot like a userbot
Alragi
Alragi10mo ago
Will I get a solution? 👀
Brody
Brody10mo ago
is it s userbot?
Alragi
Alragi10mo ago
correct Yes.
Brody
Brody10mo ago
then we wont be able to help with this https://railway.app/legal/fair-use and i recommend you find a different place to host it, like a VPS
Alragi
Alragi10mo ago
Oh please, the VPS issue is very expensive and doesn't run much at all
Brody
Brody10mo ago
its just simply not allowed, sorry
Alragi
Alragi10mo ago
@josh Please.
Brody
Brody10mo ago
#🛂|readme #5
Alragi
Alragi10mo ago
I don't know what you mean, but if you find a command that runs the command instead of using screen, it will undoubtedly work.
Brody
Brody10mo ago
you are not allowed to run a userbot on railway
josh
josh10mo ago
ok so i have the following advice to offer you: 1) you will probably need to host this as two different services and allow them to communicate with each other 2) probably don't open another help thread about this in the future because brody, the railway team and anyone who's affiliated with railway will probably not help you and won't be allowed to help you as writing a userbot is technically against TOS 3) because of 2) you should try roadmap.sh - it's a great way to learn python quickly
Alragi
Alragi10mo ago
Ok, sorry, I didn't know. Is it because railway cannot operate it or do you not operate it?
Brody
Brody10mo ago
sorry, im going to lock and close out this thread now, userbots are not allowed on railway, theres no two ways about that, running your bot on railway puts you at risk of getting banned from railway