now that the self-boost script is back up and running, i need to figure out how to make a systemd script that runs it for me

trivial unit files fur systemd 

@MindmeshLink the trivial systemd script fur daemons that are Just A Purrocess You Simply Run From The Command Line is

$ cat /etc/systemd/system/my-unit-name.service
[Unit]
Description=name of this service

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
ExecStart=[command line here (you can use spaces)]

# the following make systemd automatically re-up the service every time it downs, which is usually desirable behavior
Restart=always
RestartSec=1 # you usually want some throttling in case it keeps exiting immediately

then run systemctl daemon-reload, and then systemctl enable my-unit-name.service (.service is optional). use systemctl status my-unit-name.service if you want confurmation that it worked fine.

standard output and error should automatically get logged to the systemd journal; you can view that output with journalctl -u my-unit-name.service

useful extra things re: trivial unit files fur systemd 

@MindmeshLink

  • under the service section, WorkingDirectory=/path/to/desired/working/directory; if your script picks up configs from the current directory this will make setup simpler
  • to run as a user who is not root, User=username, in the same section
  • if needed, you can specify as many Environment="ENV_VAR=whatever" lines as required under that same section
  • (you can also specify an environment file with EnvironmentFile=/path/to/file; the syntax is in VAR="contents" furmat)

useful extra things re: trivial unit files fur systemd 

@aescling the big extra thing is that i need to write it
- in a way NixOS understands (kinda trivial, i broadly know how)
- in a way that uses the virtual env i used for python (that one's harder but i think i see how?)

Follow

unsolicited suggestion re: useful extra things re: trivial unit files fur systemd 

@MindmeshLink an arguable cheat is ExecStart=fish -c "[whatever the venv command is, i furget]; exec [final command]. i think that should work

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.