Add rsync.rc?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Add rsync.rc?

Kenneth R Westerback
With inetd now being off by default, I found the only thing I was
running from it was rsync. Hence creating my first .rc file --
rsync.rc.

Seems to work for starting/stopping/checking and allows pkg_scripts to
start it up.

I am conflicted on whether is should be called 'rsync.rc', since rsync
is the program name, or 'rsyncd.rc' because we are starting it as a
daemon and it does make log entries as 'rsyncd'. Also not sure on
best way to get a mention into the man pages. :-)

My cvs foo not being sufficient to generate a diff w/o adding the file
to the repository, here's the contents I came up with.

.... Ken

#!/bin/sh
#
# $OpenBSD $

daemon="${TRUEPREFIX}/bin/rsync"
daemon_flags="--daemon"

. /etc/rc.d/rc.subr

rc_cmd $1

Reply | Threaded
Open this post in threaded view
|

Re: Add rsync.rc?

Antoine Jacoutot-7
On Sun, Apr 21, 2013 at 10:50:06AM -0400, Kenneth R Westerback wrote:

> With inetd now being off by default, I found the only thing I was
> running from it was rsync. Hence creating my first .rc file --
> rsync.rc.
>
> Seems to work for starting/stopping/checking and allows pkg_scripts to
> start it up.
>
> I am conflicted on whether is should be called 'rsync.rc', since rsync
> is the program name, or 'rsyncd.rc' because we are starting it as a
> daemon and it does make log entries as 'rsyncd'. Also not sure on
> best way to get a mention into the man pages. :-)
>
> My cvs foo not being sufficient to generate a diff w/o adding the file
> to the repository, here's the contents I came up with.

Looks fine at first glance but you may want to add --daemon directly into the daemon variable:
daemon="${TRUEPREFIX}/bin/rsync --daemon"
since the script is meant to start rsync in daemon mode anyway.

I would call the rc script rsyncd...
Not sure what you mean for the man page; package daemons are usually start up using rc.d(8) so I don't think it is necessary to mention it in the man page.

> #!/bin/sh
> #
> # $OpenBSD $
>
> daemon="${TRUEPREFIX}/bin/rsync"
> daemon_flags="--daemon"
>
> . /etc/rc.d/rc.subr
>
> rc_cmd $1
>

--
Antoine

Reply | Threaded
Open this post in threaded view
|

Re: Add rsync.rc?

Kenneth R Westerback
On Sun, Apr 21, 2013 at 05:00:04PM +0200, Antoine Jacoutot wrote:

> On Sun, Apr 21, 2013 at 10:50:06AM -0400, Kenneth R Westerback wrote:
> > With inetd now being off by default, I found the only thing I was
> > running from it was rsync. Hence creating my first .rc file --
> > rsync.rc.
> >
> > Seems to work for starting/stopping/checking and allows pkg_scripts to
> > start it up.
> >
> > I am conflicted on whether is should be called 'rsync.rc', since rsync
> > is the program name, or 'rsyncd.rc' because we are starting it as a
> > daemon and it does make log entries as 'rsyncd'. Also not sure on
> > best way to get a mention into the man pages. :-)
> >
> > My cvs foo not being sufficient to generate a diff w/o adding the file
> > to the repository, here's the contents I came up with.
>
> Looks fine at first glance but you may want to add --daemon directly into the daemon variable:
> daemon="${TRUEPREFIX}/bin/rsync --daemon"
> since the script is meant to start rsync in daemon mode anyway.

Makes sense. And makes it less vulnerable to adding other options. Thanks.

>
> I would call the rc script rsyncd...
> Not sure what you mean for the man page; package daemons are usually start up using rc.d(8) so I don't think it is necessary to mention it in the man page.
>

I only thought of the man page since it mentions 'inetd-like' and standalone
as ways of operation. I can read that as including rc.d. :-)

.... Ken

> > #!/bin/sh
> > #
> > # $OpenBSD $
> >
> > daemon="${TRUEPREFIX}/bin/rsync"
> > daemon_flags="--daemon"
> >
> > . /etc/rc.d/rc.subr
> >
> > rc_cmd $1
> >
>
> --
> Antoine

Reply | Threaded
Open this post in threaded view
|

Re: Add rsync.rc?

Stuart Henderson-6
In reply to this post by Antoine Jacoutot-7
On 2013/04/21 17:00, Antoine Jacoutot wrote:

> On Sun, Apr 21, 2013 at 10:50:06AM -0400, Kenneth R Westerback wrote:
> > With inetd now being off by default, I found the only thing I was
> > running from it was rsync. Hence creating my first .rc file --
> > rsync.rc.
> >
> > Seems to work for starting/stopping/checking and allows pkg_scripts to
> > start it up.
> >
> > I am conflicted on whether is should be called 'rsync.rc', since rsync
> > is the program name, or 'rsyncd.rc' because we are starting it as a
> > daemon and it does make log entries as 'rsyncd'. Also not sure on
> > best way to get a mention into the man pages. :-)
> >
> > My cvs foo not being sufficient to generate a diff w/o adding the file
> > to the repository, here's the contents I came up with.
>
> Looks fine at first glance but you may want to add --daemon directly into the daemon variable:
> daemon="${TRUEPREFIX}/bin/rsync --daemon"
> since the script is meant to start rsync in daemon mode anyway.
>
> I would call the rc script rsyncd...
> Not sure what you mean for the man page; package daemons are usually start up using rc.d(8) so I don't think it is necessary to mention it in the man page.

This one also needs rc_reload=NO.


Reply | Threaded
Open this post in threaded view
|

Re: Add rsync.rc?

Kenneth R Westerback
On Sun, Apr 21, 2013 at 08:23:28PM +0100, Stuart Henderson wrote:

> On 2013/04/21 17:00, Antoine Jacoutot wrote:
> > On Sun, Apr 21, 2013 at 10:50:06AM -0400, Kenneth R Westerback wrote:
> > > With inetd now being off by default, I found the only thing I was
> > > running from it was rsync. Hence creating my first .rc file --
> > > rsync.rc.
> > >
> > > Seems to work for starting/stopping/checking and allows pkg_scripts to
> > > start it up.
> > >
> > > I am conflicted on whether is should be called 'rsync.rc', since rsync
> > > is the program name, or 'rsyncd.rc' because we are starting it as a
> > > daemon and it does make log entries as 'rsyncd'. Also not sure on
> > > best way to get a mention into the man pages. :-)
> > >
> > > My cvs foo not being sufficient to generate a diff w/o adding the file
> > > to the repository, here's the contents I came up with.
> >
> > Looks fine at first glance but you may want to add --daemon directly into the daemon variable:
> > daemon="${TRUEPREFIX}/bin/rsync --daemon"
> > since the script is meant to start rsync in daemon mode anyway.
> >
> > I would call the rc script rsyncd...
> > Not sure what you mean for the man page; package daemons are usually start up using rc.d(8) so I don't think it is necessary to mention it in the man page.
>
> This one also needs rc_reload=NO.
>
>

Here's the diff incorporating the feedback so far.

Built package and installing it creates the /etc/rc.d/rsyncd I
expected.

ok?

.... Ken

Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/rsync/pkg/PLIST,v
retrieving revision 1.13
diff -u -p -r1.13 PLIST
--- pkg/PLIST 23 Aug 2012 13:27:51 -0000 1.13
+++ pkg/PLIST 21 Apr 2013 17:14:11 -0000
@@ -8,3 +8,4 @@ bin/rrsync
 share/doc/rsync/
 share/doc/rsync/tech_report.tex
 @extra ${SYSCONFDIR}/rsyncd.conf
+@rcscript ${RCDIR}/rsyncd
Index: pkg/rsyncd.rc
===================================================================
RCS file: pkg/rsyncd.rc
diff -N pkg/rsyncd.rc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/rsyncd.rc 21 Apr 2013 20:43:50 -0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD $
+
+daemon="${TRUEPREFIX}/bin/rsync --daemon"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1