Re: [systemd-devel] WorkingDirectory in service file
Colin Guthrie on Thu, 24 Nov 2011 20:51:19 +: > 'Twas brillig, and Christian Hesse at 23/11/11 20:07 did gyre and gimble: > > Christian Hesse on Tue, 22 Nov 2011 14:44:01 +0100: > >> [...] > >> Looks like WorkingDirectory is ignored and the real working directory > >> is / as I have to call scripts within the configuration with absolute > >> paths. pwd run inside a script gives "/". > >> Everything works as expected (with relative paths) when launching > >> openvpn from /etc/openvpn manually. Any hints what goes wrong? > > > > Ok, solved this... > > systemd works as expected but openvpn does a chdir("/") when forking to > > background. In respect to daemon(3) this seems to be the expected > > behavior. > > > One "solution" here might be to not call --daemon NAME, but instead call > --syslog NAME and set Type=simple in the systemd unit. > > This should keep openvpn in the foreground and use systemd's > backgounding and hopefully the WorkingDirectory thing will work. > > Not sure if you really need this, or if it was more of a random query.. It works as it is now. The one drawback is that I have to give absolut paths to the up and route-up scripts. I think it's ok now that I know the reason. ;) -- Schoene Gruesse Chris ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] WorkingDirectory in service file
'Twas brillig, and Christian Hesse at 23/11/11 20:07 did gyre and gimble: > Christian Hesse on Tue, 22 Nov 2011 14:44:01 +0100: >> [...] >> Looks like WorkingDirectory is ignored and the real working directory >> is / as I have to call scripts within the configuration with absolute >> paths. pwd run inside a script gives "/". >> Everything works as expected (with relative paths) when launching >> openvpn from /etc/openvpn manually. Any hints what goes wrong? > > Ok, solved this... > systemd works as expected but openvpn does a chdir("/") when forking to > background. In respect to daemon(3) this seems to be the expected > behavior. One "solution" here might be to not call --daemon NAME, but instead call --syslog NAME and set Type=simple in the systemd unit. This should keep openvpn in the foreground and use systemd's backgounding and hopefully the WorkingDirectory thing will work. Not sure if you really need this, or if it was more of a random query.. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] WorkingDirectory in service file
Christian Hesse on Tue, 22 Nov 2011 14:44:01 +0100: > [...] > Looks like WorkingDirectory is ignored and the real working directory > is / as I have to call scripts within the configuration with absolute > paths. pwd run inside a script gives "/". > Everything works as expected (with relative paths) when launching > openvpn from /etc/openvpn manually. Any hints what goes wrong? Ok, solved this... systemd works as expected but openvpn does a chdir("/") when forking to background. In respect to daemon(3) this seems to be the expected behavior. -- Schoene Gruesse Chris ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] WorkingDirectory in service file
Hello everybody, I use a service file for openvpn from the Arch Linux systemd-arch-units package: [Unit] Description=OpenVPN connection to %i After=network.target [Service] Type=forking ExecStart=/usr/sbin/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i WorkingDirectory=/etc/openvpn [Install] WantedBy=multi-user.target Looks like WorkingDirectory is ignored and the real working directory is / as I have to call scripts within the configuration with absolute paths. pwd run inside a script gives "/". Everything works as expected (with relative paths) when launching openvpn from /etc/openvpn manually. Any hints what goes wrong? -- Schoene Gruesse Chris ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel