For the record, I answered this on IRC. Using /tmp in a hook on EL7
won't work as expected, since httpd has its own /tmp namespace
(PrivateTmp=true in the systemd unit). Writing logs elsewhere ought to
be visible to both httpd and your shell.
···
On 23/08/15 17:43, Александр Костырев wrote:
> Hello!
>
> I'm struggling with hooks and the don't work for me.
> CentOS7
> selinux is in permissive
>
> [...]
> it's executable
> # ll /usr/share/foreman/config/hooks/host/managed/after_commit/30_test
> -rwxr-xr-x. 1 root root 100 Aug 23 19:12
> /usr/share/foreman/config/hooks/host/managed/after_commit/30_test
>
> cat /usr/share/foreman/config/hooks/host/managed/destroy/30_test
> #!/bin/sh
>
> echo >> /tmp/hooklog
> date >> /tmp/hooklog
> echo 'Yay it ran!' ${1} Host: ${2} >> /tmp/hooklog
> cat >> /tmp/hooklog
> For the record, I answered this on IRC. Using /tmp in a hook on EL7
> won't work as expected, since httpd has its own /tmp namespace
> (PrivateTmp=true in the systemd unit). Writing logs elsewhere ought to
> be visible to both httpd and your shell.