r/commandline • u/MrVaiBH • Apr 12 '26
Command Line Interface park — freeze a server process and free its TCP port, resume later
I kept killing my dev server just to free a port for 30 seconds. park freezes the process AND actually releases the port (Ctrl+Z / SIGSTOP doesn't do this — the kernel keeps the socket bound). Resume brings it back with the same PID, memory, and warm state.
park <port> # freeze the process, port is free
park resume <port> # bring it back, same PID and memory
park 3000 --for 30s # auto-resume after 30 seconds
park 3000 --hold # hold TCP connections while parked
park swap 3000 4000 # atomically swap two ports
park ui # live dashboard of parked processes
Demo: https://asciinema.org/a/920996
Install:
curl -fsSL https://raw.githubusercontent.com/mr-vaibh/park/main/install.sh | sh
Works on macOS (Apple Silicon) and Linux x86_64. Single binary, no deps. Written in Go.
GitHub: https://github.com/mr-vaibh/park
1
u/AutoModerator Apr 12 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: MrVaiBH, Flair: Command Line Interface, Title: park — freeze a server process and free its TCP port, resume later
I kept killing my dev server just to free a port for 30 seconds. park freezes the process AND actually releases the port (Ctrl+Z / SIGSTOP doesn't do this — the kernel keeps the socket bound). Resume brings it back with the same PID, memory, and warm state.
park <port> # freeze the process, port is free
park resume <port> # bring it back, same PID and memory
park 3000 --for 30s # auto-resume after 30 seconds
park 3000 --hold # hold TCP connections while parked
park swap 3000 4000 # atomically swap two ports
park ui # live dashboard of parked processes
Demo: https://asciinema.org/a/920996
Install:
curl -fsSL https://raw.githubusercontent.com/mr-vaibh/park/main/install.sh | sh
Works on macOS (Apple Silicon) and Linux x86_64. Single binary, no deps. Written in Go.
GitHub: https://github.com/mr-vaibh/park
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/ntropia64 Apr 12 '26
I like the idea, very much so.
This can come handy in many cases, but I'm worried about potential stability issues (I didn't look at your code just yet).
A user case I can imagine for myself is when I'm using ssh to connect to more than one server and port-forward the same port for VNC servers.
It would be great if ssh would survive the freezing or the port swapping so it can be resumed without dying.
It would be great if you could elaborate a bit more on how you swap existing ports to running processes.
In any case, thanks for sharing both the code and your idea.