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