R
Railwayβ€’15mo ago
Yash

Is there a way to auto restart a service to save memory? There an api available that we can trigger?

I want to see if there is a way to restart my service in specified durations. if there's an api trigger, that would help too.
23 Replies
Percy
Percyβ€’15mo ago
Project ID: N/A
Yash
YashOPβ€’15mo ago
N/A
Brody
Brodyβ€’15mo ago
I'll do you one better than an api https://railway.app/template/fwH-l3 bookmarklet website has changed to https://bookmarklets.up.railway.app/cron-config/
Yash
YashOPβ€’15mo ago
life saver. thanks so much time=2023-09-05T09:57:57.215Z level=ERROR msg="failed retrieving user information: input:3: me Not Authorized" Any chance you know how i can fix this? ime=2023-09-05T09:57:57.141Z level=INFO msg="parsed schedules from environment successfully" found_schedules=1 time=2023-09-05T09:57:57.141Z level=INFO msg="found schedule" service_id=8b5f7be3-4a54-44b3-ac51-175b4f1ba975/variables action=restart expression="55 * * * *" time=2023-09-05T09:57:57.215Z level=ERROR msg="failed retrieving user information: input:3: me N I believe i copied the token correctly.
Ray
Rayβ€’15mo ago
hey, can you link me to your project?
Yash
YashOPβ€’15mo ago
ca440142-97f8-497c-8374-bdd45e8e3749 project id
Ray
Rayβ€’15mo ago
the token you added, is it a project token? project -> settings -> tokens
Yash
YashOPβ€’15mo ago
no, account -> settings -> tokens
Ray
Rayβ€’15mo ago
try it with a project token actually no don't, I doubt that'd work
Ray
Rayβ€’15mo ago
is the token you created tied to your team?
No description
Yash
YashOPβ€’15mo ago
yes i tried with 3 different tokens, same issue
Ray
Rayβ€’15mo ago
@Brody
time=2023-09-05T09:57:57.215Z level=ERROR msg="failed retrieving user information: input:3: me N
^ is it calling the me query? I think you'd have to call another endpoint for retrieving team info
Brody
Brodyβ€’15mo ago
give me a team account so I can test, id be happy to make this work, but I don't know how to do that without a team account πŸ™‚
Ray
Rayβ€’15mo ago
sent ya an invite πŸ™‚
Brody
Brodyβ€’15mo ago
woohoo pro plan I'll work on this soon!
Yash
YashOPβ€’15mo ago
thanks both.
Brody
Brodyβ€’15mo ago
alright so ive fixed two things, a bug in the bookmarklet, and now the template can restart services that reside within a team. - remove your current "Railway Cron Config" bookmarklet and add it back https://bookmarklets.up.railway.app/cron-config/ - generate the same schedule string - update the schedule service variable - let the service redeploy, it should pull the updated docker image and just start working and a little tag for extra visibility @Yash πŸ™‚ and thanks ray, without you i wouldnt have been able to fix this
Yash
YashOPβ€’15mo ago
Cool!
Brody
Brodyβ€’15mo ago
just make sure you use the appropriate token, for the service you want to restart
Yash
YashOPβ€’15mo ago
you mean the account token, right? Worked it seems, thanks!
Brody
Brodyβ€’15mo ago
awesome, fixed on the first try that's unlike me
Kevin Shiuan
Kevin Shiuanβ€’15mo ago
@Brody Thank you so much, this is what i have been looking for!
Brody
Brodyβ€’15mo ago
no problem, let me know if there are any problems
Want results from more Discord servers?
Add your server