goslmailer icon indicating copy to clipboard operation
goslmailer copied to clipboard

systemd for tgslurmbot (and possibly the other ones)

Open hariseldon99 opened this issue 2 years ago • 2 comments

This works:

[Unit]
Description=TelegramBot for goslmailer
DefaultDependencies=no
Wants=network-online.target
After=network.target network-online.target

[Service]
Type=simple
User=slurm
WorkingDirectory=/
ExecStart=/usr/local/bin/tgslurmbot

[Install]
WantedBy=multi-user.target

Maybe put it in?

Just a suggestion.

hariseldon99 avatar Feb 27 '23 15:02 hariseldon99

Great idea, thanks for the service file. I'll update the PR with the panic code from the other issue you had and put this in next release zip as a sample.

pja237 avatar Feb 27 '23 21:02 pja237

Hi, I'm using a similar service file and I'm getting this error when booting:

"dial tcp: lookup api.telegram.org: Temporary failure in name resolution"

After boot, I simply restart the service and it works properly. I assume the problem is that the service is starting before the DNS, but I cannot make it work using After= and Wants=. Does anyone have the same error?

These are the service file I'm using: telegram service:

[Unit]
Description=Goslmailer Telegram daemon
Before=slurmctld.service goslmailer-gobler.service
ConditionPathExists=/etc/slurm/goslmailer.conf
After=network.target network-online.target systemd-resolved.service nss-lookup.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/opt/slurmtools/goslmailer/tgslurmbot -c /etc/slurm/goslmailer.conf
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/slurm/tgslurmbot.pid
User=slurm
Group=slurm

[Install]
WantedBy=multi-user.target

goslmailer-gobler.service:

[Unit]
Description=Goslmailer Gobler
Before=slurmctld.service
ConditionPathExists=/etc/slurm/gobler.conf

[Service]
Type=simple
ExecStart=/opt/slurmtools/goslmailer/gobler -c /etc/slurm/gobler.conf
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/slurm/gobler.pid
User=slurm
Group=slurm

[Install]
WantedBy=multi-user.target

pdpino avatar Feb 26 '25 14:02 pdpino