1. Service files are created in /etc/systemd/system and are plain text files ending in .service

This is Hades’ service file:

[Unit]
Description=Hades Discord Bot
After=network.target
 
[Service]
WorkingDirectory=/path/to/hades
ExecStart=/home/user/.bun/bin/bun /path/to/hades/src/main.ts
StandardOutput=inherit
StandardError=inherit
Restart=always
 
[Install]
WantedBy=multi-user.target

Starting the Service

systemctl enable ________.service. This will start the service after restarting the server.

You can use systemctl to start and manage services. Or, add the --now flag to systemd to enable and start it in one go.

debian ubuntu linux