Start.sh with sytemd service unit

Hello, I’m looking for an example to start the cedalo file start.sh via systemd in ubuntu.
I only get “bad settings” when the service starts.
My .service file looks like this:
Thanks!
##################################
[Unit]
Description=MQTTService

[Service]
Type=simple
ExecStart=cd ~/cedalo_platform | sudo sh start.sh

[Install]
WantedBy=multi-user.target

Hi Klaus,

I think the problem is the | in your ExecStart line, and also possibly that ~ will point to the wrong place. I’ve created a unit file below that I’ve tested with my system. You should modify /absolute/path/to/cedalo_platform to be the correct path - not using a ~. If you then copy it to /etc/systemd/system/cedalo-platform.service then you will be able to control it with systemctl start cedalo-platform and systemctl enable cedalo-platform and so on.

I hope that helps!

Regards,

Roger

[Unit]
Description=Cedalo Platform
Documentation=https://docs.cedalo.com/latest/
After=network.target
Wants=network.target

[Service]
Type=simple
WorkingDirectory=/absolute/path/to/cedalo_platform
ExecStart=/absolute/path/to/cedalo_platform/start.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target
1 Like

Hi Roger, thank you for your help. It works now!

Just a thought, but you might want to add a dependence on starting After the docker.service too…as well as adding the stop executable:

[Service]
ExecStop=/absolute/path/to/cedalo_platform/stop.sh

(these things tripped me up recently :slight_smile: )