Re: [pve-devel] [PATCH pve-manager] check if dir /var/log/pveproxy exists.
On Tue, Nov 29, 2016 at 11:46:26AM +0100, Fabian Grünbichler wrote: > On Thu, Sep 15, 2016 at 01:09:38PM +0200, Dietmar Maurer wrote: > > > > > > > On September 15, 2016 at 12:25 PM Wolfgang Link> > > wrote: > > > > > > > > > We will check on every start of pveproxy if the logdir are available. > > > If not we make a new one and give www-data permission to this dir. > > > > And you want to do that with every directory? > > this came up in a bug report with /var/log on tmpfs: > https://bugzilla.proxmox.com/show_bug.cgi?id=1216 > > are there still objections to adding this? I think recreating a needed > log directory is good behaviour for a service daemon anyway.. Ack. (But can we just do `if (mkdir(...))` instead of checking with -d? Checking dirs before creating them is generally a bad style since mkdir can fail with EEXIST anyway) ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH pve-manager] check if dir /var/log/pveproxy exists.
On Thu, Sep 15, 2016 at 01:09:38PM +0200, Dietmar Maurer wrote: > > > > On September 15, 2016 at 12:25 PM Wolfgang Linkwrote: > > > > > > We will check on every start of pveproxy if the logdir are available. > > If not we make a new one and give www-data permission to this dir. > > And you want to do that with every directory? this came up in a bug report with /var/log on tmpfs: https://bugzilla.proxmox.com/show_bug.cgi?id=1216 are there still objections to adding this? I think recreating a needed log directory is good behaviour for a service daemon anyway.. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH pve-manager] check if dir /var/log/pveproxy exists.
> On September 15, 2016 at 12:25 PM Wolfgang Linkwrote: > > > We will check on every start of pveproxy if the logdir are available. > If not we make a new one and give www-data permission to this dir. And you want to do that with every directory? ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager] check if dir /var/log/pveproxy exists.
We will check on every start of pveproxy if the logdir are available. If not we make a new one and give www-data permission to this dir. The reason for this is, if someone remove the directory /var/log/pveproxy pveproxy can't access the log. This permit the user to use the GUI after a reboot or a restart of the service. --- bin/pveproxy | 8 1 file changed, 8 insertions(+) diff --git a/bin/pveproxy b/bin/pveproxy index 20e8f2a..6a624a8 100755 --- a/bin/pveproxy +++ b/bin/pveproxy @@ -19,6 +19,14 @@ $SIG{'__WARN__'} = sub { $@ = $err; }; +my $log = "/var/log/pveproxy"; + +if (!-d $log) { +mkdir $log; +my (undef, undef, $uid, $gid) = getpwnam('www-data'); +chown $uid, $gid, $log; +} + my $prepare = sub { my $rundir="/var/run/pveproxy"; if (mkdir($rundir, 0700)) { # only works at first start if we are root) -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel