February 13, 2017

Issue with Lab 4.2

I'm having an issue on 4.2 lab with what I thought would be a simple example for setting up a service with systemd

I'm running CentOS Linux release 7.3.1611 (Core) 

[student@dolphin ~]$ sudo cat /etc/systemd/system/fake2.service
[Unit]
Description=fake2
After=network.target

[Service]
ExecStart=/bin/sh -c ’/bin/echo I am starting the fake2 service ; /bin/sleep 30’
ExecStop=/bin/echo I am stopping the fake2 service

[Install]
WantedBy=multi-user.target

student@dolphin ~]$ sudo systemctl start fake2.service
Failed to start fake2.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status fake2.service' for details.
[student@dolphin ~]$ sudo systemctl -l status fake2.service
● fake2.service - fake2
   Loaded: error (Reason: Invalid argument)
   Active: failed (Result: exit-code) since Mon 2017-02-13 10:27:39 EST; 3min 42s ago
 Main PID: 4068 (code=exited, status=127)

Feb 13 10:27:39 dolphin.localdomain sh[4068]: I: ’/usr/bin/echo: No such file or directory
Feb 13 10:27:39 dolphin.localdomain systemd[1]: fake2.service: main process exited, code=exited, status=127/n/a
Feb 13 10:27:39 dolphin.localdomain systemd[1]: Failed to start fake2.
Feb 13 10:27:39 dolphin.localdomain systemd[1]: Unit fake2.service entered failed state.
Feb 13 10:27:39 dolphin.localdomain systemd[1]: fake2.service failed.
Feb 13 10:29:21 dolphin.localdomain systemd[1]: [/etc/systemd/system/fake2.service:6] Trailing garbage, ignoring.
Feb 13 10:29:21 dolphin.localdomain systemd[1]: fake2.service has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.
Feb 13 10:30:05 dolphin.localdomain systemd[1]: [/etc/systemd/system/fake2.service:6] Trailing garbage, ignoring.
Feb 13 10:30:05 dolphin.localdomain systemd[1]: fake2.service has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.
Feb 13 10:31:08 dolphin.localdomain systemd[1]: fake2.service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

 

 

 

Click Here!