I'm using Debian Jessie with the latest updates. I made a systemd service to run a script when my server starts. Here's its configuration:
[Unit]
Description=(my description)
[Service]
ExecStart=/usr/bin/bot
Restart=restart-always
[Install]
WantedBy=multi-user.target
/usr/bin/bot
is a script running a Mono executable. It consists of:
#!/bin/bash
(cd /path/to/my/executable && mono bot.exe)
(I replaced the path here, but the one on my script is correct.)
When I run the script /usr/bin/bot
normally (simply /usr/bin/bot
on my terminal), it is working as expected. top
reports it's using between 0 and, say, 20% of my CPU, which is normal. But when I start it with service bot start
, top
says it's always using at least 100% of my CPU.
In both cases bot
is working as expected.
What could explain such a big difference in CPU usage?
Thank you.
bot
process which is using all the CPU. Systemd is not magical and can't affect your program's behavior beyond starting it, sending it signals, and perhaps killing it.