Jump to content

How to Enter Program Administration to a service that is already running?

Go to solution Solved by Jarsky,
3 hours ago, dj_ripcord said:

Yep this would work! That is.... if the server wasn't already running. I tried using rptyer to attach it to a new terminal but I was either unable to find the PID of the server or it would not give me permission. Even as sudo.

to use a screen emulator, it needs to be started from screen/tmux first, in order to connect to the session. 

the ID is not the process id of the server, its the tmux session id. 

 

So you'd need to run ps aux | grep terraria to find the PID of the terraria server, and then kill -9 <pid> to terminate the current terraria server. 

Then restart it within a tmux session. 

 

You might be interested in this, which shows how to set it up with Screen as a systemd service https://www.linode.com/docs/game-servers/host-a-terraria-server-on-your-linode/

 

That way you can start/stop it using the 'service terraria start/stop' command. 

Basic screen commands are

screen -r (to attach, if you only have a single screen session)

screen -ls (list screen sessions)

screen -r pid/name (to attach a specific screen when more than 1 session)

 

 

Hello all,

 

Asking here because I couldn't figure out how to word this question into Google.

 

I am running a dedicated Terraria server on my linux machine. This machine also runs a webserver but that's unimportant. SSH sessions only last so long before they timeout due to inactivity. And when I start the server, I am greeted by the administration console. Problem is; if the server is already running, I don't know how to get into the admin console without starting the server again. And I'm not sure if running the start script again would cause a problem due to two instances running at once or if it simply woudn't work at all.

 

I am moderately familiar with Linux but sometimes bash gets the best of me. 

 

Do you folks know how I need to proceed? I think I can solve this using Screen but i'm not sure how to set it up.

 

Thanks!

"Although there's a problem on the horizon; there's no horizon." - K-2SO

Link to comment
Share on other sites

Link to post
Share on other sites

Here's a super quick 'n dirty rundown on Tmux: 

Prerequisite: have tmux installed. Should be available in every repo if you don't already have it. This is similar to screen, and most folks will prefer it since screen isn't really maintained anymore. 

 

1. enter the command tmux to enter a new session. 

2. Fire up your terraria server with your shell script or whatever. 

3. Detatch from the tmux session by hitting ctrl+B, D. Now the session is effectively in the 'background' and you are free to disconnect from ssh. 

4. When you want to get back to the server console, use tmux a to Attach to the session you left behind earlier. 

Intel 11700K - Gigabyte 3080 Ti- Gigabyte Z590 Aorus Pro - Sabrent Rocket NVME - Corsair 16GB DDR4

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, jake9000 said:

Here's a super quick 'n dirty rundown on Tmux: 

Prerequisite: have tmux installed. Should be available in every repo if you don't already have it. This is similar to screen, and most folks will prefer it since screen isn't really maintained anymore. 

 

1. enter the command tmux to enter a new session. 

2. Fire up your terraria server with your shell script or whatever. 

3. Detatch from the tmux session by hitting ctrl+B, D. Now the session is effectively in the 'background' and you are free to disconnect from ssh. 

4. When you want to get back to the server console, use tmux a to Attach to the session you left behind earlier. 

Yep this would work! That is.... if the server wasn't already running. I tried using rptyer to attach it to a new terminal but I was either unable to find the PID of the server or it would not give me permission. Even as sudo.

"Although there's a problem on the horizon; there's no horizon." - K-2SO

Link to comment
Share on other sites

Link to post
Share on other sites

Screen is also an option. 

 

Use whichever you find easier

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, dj_ripcord said:

Yep this would work! That is.... if the server wasn't already running. I tried using rptyer to attach it to a new terminal but I was either unable to find the PID of the server or it would not give me permission. Even as sudo.

to use a screen emulator, it needs to be started from screen/tmux first, in order to connect to the session. 

the ID is not the process id of the server, its the tmux session id. 

 

So you'd need to run ps aux | grep terraria to find the PID of the terraria server, and then kill -9 <pid> to terminate the current terraria server. 

Then restart it within a tmux session. 

 

You might be interested in this, which shows how to set it up with Screen as a systemd service https://www.linode.com/docs/game-servers/host-a-terraria-server-on-your-linode/

 

That way you can start/stop it using the 'service terraria start/stop' command. 

Basic screen commands are

screen -r (to attach, if you only have a single screen session)

screen -ls (list screen sessions)

screen -r pid/name (to attach a specific screen when more than 1 session)

 

 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | EVGA GTX1070 FTW | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO | 12 x 8TB HGST Ultrastar He10 (WD Whitelabel) | 500GB Aorus Gen4 NVMe | 2 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, Jarsky said:

to use a screen emulator, it needs to be started from screen/tmux first, in order to connect to the session. 

the ID is not the process id of the server, its the tmux session id. 

 

So you'd need to run ps aux | grep terraria to find the PID of the terraria server, and then kill -9 <pid> to terminate the current terraria server. 

Then restart it within a tmux session. 

 

You might be interested in this, which shows how to set it up with Screen as a systemd service https://www.linode.com/docs/game-servers/host-a-terraria-server-on-your-linode/

 

That way you can start/stop it using the 'service terraria start/stop' command. 

Basic screen commands are

screen -r (to attach, if you only have a single screen session)

screen -ls (list screen sessions)

screen -r pid/name (to attach a specific screen when more than 1 session)

 

 

This ended up working.

 

I knew it would though, I just wanted to avoid using kill to terminate the process before the world could be saved. So I bit the bullet and did it anyway - ended up rolling back about 2 hours, but no one was playing so not a huge deal.

"Although there's a problem on the horizon; there's no horizon." - K-2SO

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×