Hacker News new | ask | show | jobs
Ask HN: How do you manage startup processes/scripts on your servers?
2 points by nerva 3839 days ago
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?

2 comments

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.

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, ...

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.