0

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.

Akarsh
  • 13
  • 1
  • 5

1 Answers1

0

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
l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • @I'L'I Could you help with https://stackoverflow.com/questions/62671161/unit-xxx-service-is-not-loaded-properly-exec-format-error-on-ubuntu18-04-creat – sumanth shetty Jul 01 '20 at 08:50