August 23, 2016

Lab 4.2 (service) does not work in Ubuntu 14.04

Enter a short description...

I am running ubuntu 14.04

nwayno@bart:~$ cat /etc/issue
Ubuntu 14.04.5 LTS \n \l

with this kernel

Linux bart 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

echo is here:
nwayno@bart:~$ which echo
/bin/echo
nwayno@bart:~$

The service is here:
nwayno@bart:/etc/systemd/system$ cat fake2.service
[Unit]
Description=fake2
After=network.target
[Service]
ExecStart=/bin/echo I am starting the fake2 service
ExecStop=/bin/echo I am stopping the fake2 service
[Install]
WantedBy=multi-user.target
nwayno@bart:/etc/systemd/system$

It's executeable:

nwayno@bart:/etc/systemd/system$ ltr fake2.service
-rwxr-xr-x 1 root root 196 Aug 19 18:06 fake2.service
nwayno@bart:/etc/systemd/system$

systemctl is NOT part of Ubuntu 14.04 -- so I use the service command:

nwayno@bart:/etc/systemd/system$ sudo service fake2.service start
fake2.service: unrecognized service
nwayno@bart:/etc/systemd/system$

It can't find it.

If I place it in /etc/init.d (different name) I get:

nwayno@bart:/etc/init.d$ sudo service fakey2.service start
/etc/init.d/fakey2.service: 1: /etc/init.d/fakey2.service: [Unit]: not
found
/etc/init.d/fakey2.service: 4: /etc/init.d/fakey2.service: [Service]:
not found
/etc/init.d/fakey2.service: 5: /etc/init.d/fakey2.service: I: not found
/etc/init.d/fakey2.service: 6: /etc/init.d/fakey2.service: I: not found
/etc/init.d/fakey2.service: 7: /etc/init.d/fakey2.service: [Install]:
not found
nwayno@bart:/etc/init.d$

For completeness the service is:

nwayno@bart:/etc/init.d$ cat fakey2.service
[Unit]
Description=fake2
After=network.target
[Service]
ExecStart=/bin/echo I am starting the fake2 service
ExecStop=/bin/echo I am stopping the fake2 service
[Install]
WantedBy=multi-user.target
nwayno@bart:/etc/init.d$

I can't go any furthur.  This does NOT run on Ubuntu 14.04.  At all.

Wayno
Click Here!