News for hackers. Stuff that matters.

Ask HN: How do you manage startup processes/scripts on your servers?

So here's my situation:

I have tmux running on my server, with ~5 windows, things like gunicorn, syncthing, custom scripts, etc. I really like to see whats being written to STDOUT and being able to kill the process/restart it manually if necessary.

I open all these things manually right now, which if my server went down I'd be screwed hard until I noticed.

So is there some way to open tmux on startup with my processes so if something happens I don't have to worry?

Or a better way to accomplish the same thing? How do do you guys/ladies do this?

( 3 comments | 2 points | on HN )
Re:Ask HN: How do you manage startup processes/scripts on yo... by zbuf on Sunday December 20, 2015 @10:54AM (#10767336)
Other posters are right, that services should really be started as services. I have a piece of code which turns any basic foreground app into a daemon, with logging and auto-restarts and it's great for node.js and similar. Time being available I'd like to share this online sometime.

As for your specific situation, I do something similar but with screen not tmux. A cron job with @reboot, and then a screenrc file starts each terminal with the appropriate application. This is good for systems such as realtime audio processors which have a live display, which straddle the line a little between a daemon and interactive application.

Re:Ask HN: How do you manage startup processes/scripts on yo... by DanielDent on Sunday December 20, 2015 @05:34AM (#10766684)
Ugly hack: Use a cron job with "@reboot" as the time.

Better: Start your processes with systemd or another supervisor. You can restart them manually, view their output using journalctl, ...

Re:Ask HN: How do you manage startup processes/scripts on yo... by liw on Sunday December 20, 2015 @06:53AM (#10766813)
This. Running services under screen or tmux is a kludge at best. For unimportant or personal things, fine, but for any serious services, it's not the way to go.