[CentOS] systemctl (again)

Sat Apr 4 08:29:36 UTC 2015
Andrew Holway <andrew.holway at gmail.com>

Thats wierd. I've never had any problem with systemctl or systemd like that.

Do you have your service file in the right place with the right
permissions. here is the httpd service file as a reference.


[centos at ipa ~]$ ls /usr/lib/systemd/system/httpd.service -l

-rw-r--r--. 1 root root 694 Mar 12 14:57
/usr/lib/systemd/system/httpd.service


[centos at ipa ~]$ cat /usr/lib/systemd/system/httpd.service

[Unit]

Description=The Apache HTTP Server

After=network.target remote-fs.target nss-lookup.target


[Service]

Type=notify

EnvironmentFile=/etc/sysconfig/httpd

ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND

ExecReload=/usr/sbin/httpd $OPTIONS -k graceful

ExecStop=/bin/kill -WINCH ${MAINPID}

KillSignal=SIGCONT

PrivateTmp=true


[Install]

WantedBy=multi-user.target



On 4 April 2015 at 00:07, J Martin Rushton <martinrushton56 at btinternet.com>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Yet more information:
>
> As a test I moved the link
> /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service into
> /etc/systemd/user and reran systemctl daemon-reload.  I then rebooted.
>
>         # ls -l /etc/systemd/user
>         total 4
>         lrwxrwxrwx. 1 root root  41 Jul 27  2014
> dbus-org.fedoraproject.FirewallD1.service ->
> /usr/lib/systemd/system/firewalld.service
>         -rwxr-x---. 1 root root 246 Apr  3 21:21 timidity.service
>         # systemctl status dbus-org.fedoraproject.FirewallD1.service
> dbus-org.fedoraproject.FirewallD1.service
>    Loaded: not-found (Reason: No such file or directory)
>    Active: inactive (dead)
>
>         # systemctl status timidity
> timidity.service
>    Loaded: not-found (Reason: No such file or directory)
>    Active: inactive (dead)
>
> So it's starting to look like a distro problem.  Next I moved both the
> Firewall service link and the timidity service file into
> /etc/systemd/system:
>
>         # systemctl daemon-reload
>         # echo $?
>         0
>
> and rebooted.
>
>         # systemctl status dbus-org.fedoraproject.FirewallD1.service
>         firewalld.service - firewalld - dynamic firewall daemon
>            Loaded: loaded (/usr/lib/systemd/system/firewalld.service;
> enabled)
>            Active: active (running) since Fri 2015-04-03 22:50:50 ...
>          Main PID: 785 (firewalld)
>            CGroup: /system.slice/firewalld.service
>                    └─785 /usr/bin/python -Es /usr/sbin/firewalld ...
>
>         ...  Starting firewalld - dynamic firewall daemon...
>         ...  Started firewalld - dynamic firewall daemon.
>         # systemctl status timidity
>         timidity.service - timidity daemon
>            Loaded: loaded (/etc/systemd/system/timidity.service; static)
>            Active: inactive (dead)
>
> Which is progress, but where to I'm not sure.
>
>         # ls -ld system user
>         drwxr-xr-x. 14 root root 4096 Apr  3 22:48 system
>         drwxr-xr-x.  2 root root 4096 Apr  3 22:48 user
>         # getfacl system user
>         # file: system
>         # owner: root
>         # group: root
>         user::rwx
>         group::r-x
>         other::r-x
>
>         # file: user
>         # owner: root
>         # group: root
>         user::rwx
>         group::r-x
>         other::r-x
>
> Clearly there is a problem with my assumption about the default
> settings.  systemd appears not to read the user directory without
> modification.
>
> Trying to enable it leads to:
>
>         # systemctl enable timidity
>         The unit files have no [Install] section. They are not meant to
>         be enabled using systemctl.
>         Possible reasons for having this kind of units are:
>         1) A unit may be statically enabled by being symlinked from
>         another unit's .wants/ or .requires/ directory.
>         2) A unit's purpose may be to act as a helper for some other
>         unit which has a requirement dependency on it.
>         3) A unit may be started when needed via activation (socket,
>         path, timer, D-Bus, udev, scripted systemctl call, ...).
>
> Ah well, bed time.  I'll tussle with Poettering's logic in the morning.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (GNU/Linux)
>
> iQIcBAEBAgAGBQJVHw8xAAoJEAF3yXsqtyBlieQP/3to6d4gqWZ1HQkTvwKwgSBf
> Mg3GM6R+10E8skhHEuwAe8uX3ZznbO4F7NOMy3yRBSrL+y/fu6+U8To7T6wLvGKC
> kFbdCbWradLP31clWzVjJYVVYIUXTVpMC6u59L5IFbYzIB//KShYC7NxDAtQ17qG
> sbi82BuJRlXgF44cPnkv1LVX8OajUa6d2bppwrpZFNFQyAl3OUa7KY8rqe03kvWm
> AxAXtHB/E72rHGG7RpdvdwkOJ4FEyxMjh1rzilVBmpuZPLGzfjJhX5ColKvmq34N
> pABaBSFZeBQw/yk0KRt1eff/CBPR7pMTinxJPKuoVhbUXfJQ9yNcgXcWUg/R23+9
> DfJBYwSCAYqvdKwKx7V/1kuQD/INvQiO3NtCc9Ck4cPj1b6udCjsImof07smy7jn
> xe4q0mh4u7bx76gQQAq/4IQBBp5O8KkjK5oHt4gU2psqFLlSzvRen+fnqsDH2LaN
> HvjOAWlxS40a5+GAcXkIk9qG9kzAV6lyNvG/lPrSQHyeitjGwClAJTwHBfWI7l0e
> NuW216klW6VZP6Wm35nEAL7EZV4ADzLH2pqsOxB8dR7KdHAVq1Wwxe5XTi8cWJ8J
> s4c2vT6uVpthpzGSbdEMoQla/DVp+h56vl2fFeY5Fww2MhODu7CmkUI2P7pvgKXy
> icO1B4BtoxgV4dEXuHMK
> =v3W6
> -----END PGP SIGNATURE-----
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>