Re: Is there a default for 'pid file' for rsync in daemon mode?

2021-01-01 Thread raf via rsync
On Fri, Jan 01, 2021 at 11:31:11AM +, Chris Green via rsync 
 wrote:

> Francis.Montagnac--- via rsync  wrote:
> > 
> > Hi.
> > 
> > On Fri, 01 Jan 2021 09:57:38 + Chris Green via rsync wrote:
> > 
> > > My backup system crashed a couple of nights ago due to a power cut
> > > (can't really blame it!) and I went and restarted it after the power
> > > came back.  However, as I note above, files in /home/chris/tmp/pid
> > > aren't cleared out so rsync refused to run when systemd attempted to
> > > start it up.
> > 
> > > I guess the pid file should either be in /tmp or somewhere in
> > > /run/user.  However shouldn't there be some sort of sensible default
> > > if it isn't set in rsyncd.conf?
> > 
> > Since rsyncd is launched by systemd, I would say that no pid file is
> > needed: systemd will prevent simultaneous launch of rsyncd.
> > 
> > Can you try without spicifying "pid file" in rsyncd.conf ?
> > 
> > What is the content of the rsyncd.service file on your system ?
> > 
> > On Fedora it is a system (not user) service:
> > 
> > cat /lib/systemd/system/rsyncd.service 
> > [Unit]
> > Description=fast remote file copy program daemon
> > ConditionPathExists=/etc/rsyncd.conf
> > Wants=network-online.target
> > After=network-online.target
> > 
> > [Service]
> > EnvironmentFile=/etc/sysconfig/rsyncd
> > ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"
> > 
> > [Install]
> > WantedBy=multi-user.target
> > 
> You're quite right, simply removing the 'pid file' setting from
> rsynd.conf seems to work perfectly.
> 
> Maybe this should be noted somwhere in the rsyncd.conf man page.
> 
> -- 
> Chris Green

And maybe the pidfile should be locked so that a new
rsyncd process can tell if it's still in use by a
running rsyncd process. That would fix the problem on
systems that don't have systemd.

cheers,
raf


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Is there a default for 'pid file' for rsync in daemon mode?

2021-01-01 Thread Chris Green via rsync
Francis.Montagnac--- via rsync  wrote:
> 
> Hi.
> 
> On Fri, 01 Jan 2021 09:57:38 + Chris Green via rsync wrote:
> 
> > My backup system crashed a couple of nights ago due to a power cut
> > (can't really blame it!) and I went and restarted it after the power
> > came back.  However, as I note above, files in /home/chris/tmp/pid
> > aren't cleared out so rsync refused to run when systemd attempted to
> > start it up.
> 
> > I guess the pid file should either be in /tmp or somewhere in
> > /run/user.  However shouldn't there be some sort of sensible default
> > if it isn't set in rsyncd.conf?
> 
> Since rsyncd is launched by systemd, I would say that no pid file is
> needed: systemd will prevent simultaneous launch of rsyncd.
> 
> Can you try without spicifying "pid file" in rsyncd.conf ?
> 
> What is the content of the rsyncd.service file on your system ?
> 
> On Fedora it is a system (not user) service:
> 
> cat /lib/systemd/system/rsyncd.service 
> [Unit]
> Description=fast remote file copy program daemon
> ConditionPathExists=/etc/rsyncd.conf
> Wants=network-online.target
> After=network-online.target
> 
> [Service]
> EnvironmentFile=/etc/sysconfig/rsyncd
> ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"
> 
> [Install]
> WantedBy=multi-user.target
> 
You're quite right, simply removing the 'pid file' setting from
rsynd.conf seems to work perfectly.

Maybe this should be noted somwhere in the rsyncd.conf man page.

-- 
Chris Green
·


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Is there a default for 'pid file' for rsync in daemon mode?

2021-01-01 Thread Francis.Montagnac--- via rsync


Hi.

On Fri, 01 Jan 2021 09:57:38 + Chris Green via rsync wrote:

> My backup system crashed a couple of nights ago due to a power cut
> (can't really blame it!) and I went and restarted it after the power
> came back.  However, as I note above, files in /home/chris/tmp/pid
> aren't cleared out so rsync refused to run when systemd attempted to
> start it up.

> I guess the pid file should either be in /tmp or somewhere in
> /run/user.  However shouldn't there be some sort of sensible default
> if it isn't set in rsyncd.conf?

Since rsyncd is launched by systemd, I would say that no pid file is
needed: systemd will prevent simultaneous launch of rsyncd.

Can you try without spicifying "pid file" in rsyncd.conf ?

What is the content of the rsyncd.service file on your system ?

On Fedora it is a system (not user) service:

cat /lib/systemd/system/rsyncd.service 
[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf
Wants=network-online.target
After=network-online.target

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"

[Install]
WantedBy=multi-user.target

-- 
francis

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Is there a default for 'pid file' for rsync in daemon mode?

2021-01-01 Thread Chris Green via rsync
I just got bitten by a (fairly) subtle problem due to having an
inappropriate location for 'pid file' in my rsyncd.conf.

What I had was:-

pid file = /home/chris/tmp/pid

This works fine until the system running rsync in daemon mode crashes
rather than being properly shut down.  The pid file doesn't get
removed and rsync doesn't restart because it thinks it's already
running.

My backup system crashed a couple of nights ago due to a power cut
(can't really blame it!) and I went and restarted it after the power
came back.  However, as I note above, files in /home/chris/tmp/pid
aren't cleared out so rsync refused to run when systemd attempted to
start it up.

I guess the pid file should either be in /tmp or somewhere in
/run/user.  However shouldn't there be some sort of sensible default
if it isn't set in rsyncd.conf?

-- 
Chris Green
·


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html