R
Railway15mo 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
Percy15mo ago
Project ID: fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
Alragi
AlragiOP15mo ago
fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
MantisInABox
MantisInABox15mo 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
AlragiOP15mo ago
Can you guide me to create a Dockerfile? I will be grateful to you.
Brody
Brody15mo ago
you could also use parallel with nixpacks what are the two commands you want to run at the same time
Alragi
AlragiOP15mo 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
MantisInABox15mo 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
josh15mo ago
what kind of background process is it?
Alragi
AlragiOP15mo 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
Brody15mo ago
also tell us the commands you would run locally to get your project all up and running
josh
josh15mo 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
AlragiOP15mo 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
Brody15mo ago
file name??
Alragi
AlragiOP15mo ago
This is how I access the file from a VPS, for example.
Brody
Brody15mo ago
yeah but what is the file you want to run in the background
josh
josh15mo 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
AlragiOP15mo 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
Brody15mo ago
uh josh, you got this 🙂 have fun
josh
josh15mo ago
luckily i have experience with telegram bots lol
Brody
Brody15mo ago
me too, but i dont wanna open up that can of worms
Alragi
AlragiOP15mo ago
🙂♥thank you sir
josh
josh15mo ago
what exactly does the code do? is it supposed to maintain some kind of web connection?
Alragi
AlragiOP15mo ago
Why? Telegram bots are very interesting.
Brody
Brody15mo ago
i meant the can of worms as in that code you showed
Alragi
AlragiOP15mo 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
josh15mo 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
Brody15mo ago
you are not wrong
Alragi
AlragiOP15mo ago
Be optimistic, my friend, do not disappoint me 😩
josh
josh15mo ago
ok can you paste the code
Alragi
AlragiOP15mo ago
Of course, give me a sec.
Alragi
AlragiOP15mo ago
Alragi
AlragiOP15mo ago
I think the code is too big, so I'll paste some of it
Brody
Brody15mo ago
how about you share your repo
Alragi
AlragiOP15mo ago
great. Project ID: fadd4c5c-74c0-4fd7-a209-03a8f7029c8d Or you mean from github?
Brody
Brody15mo ago
yes the github repo
Alragi
AlragiOP15mo ago
GitHub
GitHub - alragi0/tmwel
Contribute to alragi0/tmwel development by creating an account on GitHub.
Brody
Brody15mo ago
neither me, josh, vin work for railway, so neither of can do anything with the id
Alragi
AlragiOP15mo ago
Did you get what you wanted?
Brody
Brody15mo ago
this is looking a lot like a userbot
Alragi
AlragiOP15mo ago
Will I get a solution? 👀
Brody
Brody15mo ago
is it s userbot?
Alragi
AlragiOP15mo ago
correct Yes.
Brody
Brody15mo 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
AlragiOP15mo ago
Oh please, the VPS issue is very expensive and doesn't run much at all
Brody
Brody15mo ago
its just simply not allowed, sorry
Alragi
AlragiOP15mo ago
@josh Please.
Brody
Brody15mo ago
#🛂|readme #5
Alragi
AlragiOP15mo 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
Brody15mo ago
you are not allowed to run a userbot on railway
josh
josh15mo 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
AlragiOP15mo ago
Ok, sorry, I didn't know. Is it because railway cannot operate it or do you not operate it?
Brody
Brody15mo 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
Want results from more Discord servers?
Add your server