I am trying to create and start a service in a Ubuntu VM, I have written a service creation and installation service randn.sh and a service script . The service generates a random number between 1-20 . When I start the service using 'systemctl randn start " it shows the error: Unit Randn.service is not loaded properly : Exec format error. My randn.service script is
[Unit]
Description = Randn daemon
After network.target = auditd.service
[Service]
Type = simple
ExecStart = /usr/local/bin/ start randn.sh
ExecStop = /usr/local/bin/ stop randn.sh
Restart = always
[Install]
WantedBy = multi-user.target
Can someone what am I doing wrong ? Is the syntax of .service file is wrong or something else in script.sh ? I am new to this, please help a noob out.
You need to remove the spaces between the options and commands in the Unit file:
Incorrect:
ExecStart = /some/command
# This should not include spaces!
Correct:
ExecStart=/some/command