I have ran into a little problem with systemd. I have a php-fpm service running, which has
PrivateTmp directive set to
There is a cronjob now which is supposed to get some files from the tmp dir of the php-fpm service. However, as the tmp files are located in
/tmp/systemd-private-<something>, the script from the cronjob can't find the files, as they are in the
PrivateTmp dir of the php-fpm service.
As a solution, I have created a systemd unit, which has a
JoinsNamespacesOf directive set to the PHP-fpm service. As indicated by the systemd documentation, it also has a
PrivateTmp=true directive. In the end, this should run from
.timer unit, but for the time being, I just start it manually.
To see if it's working, I executed
/bin/ls /tmp from my own systemd unit, assuming it would show the contents of the private-tmp directory of the PHP-fpm service. Unfortunately, it just showed the contents of the /tmp on the root file system.
I have tried to run various PHP scripts from the the service unit to see if perhaps the PHP process would somehow be aware of the fact that it should look into the
PrivateTmp directory of the php-fpm service, but alas, it did not.
Am I doing something completely wrong here or does the
JoinsNamespaceOf feature not work as advertised?
Below my systemd unit:
[Unit] Description=PrivateTmp test [Service] Type=simple JoinsNamespaceOf=php70-php-fpm.service PrivateTmp=true ExecStart=/bin/ls /tmp