Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2017 16:32:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 223325] usr.sbin/service: Add support for interacting with services in jails.
Message-ID:  <bug-223325-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D223325

            Bug ID: 223325
           Summary: usr.sbin/service: Add support for interacting with
                    services in jails.
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: dor.bsd@xm0.uk

Created attachment 187586
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D187586&action=
=3Dedit
Add jails support to /usr/sbin/service and update man page.

This patch adds support to `/usr/sbin/service` for interacting with services
within jails.

This is mostly useful when upgrading services within jails as it allows use=
rs
to stay within the usual flow and tools for upgrading packages and restarti=
ng
services.
I've been using this patch for a while now personally and everything seems =
to
work as intended.

Consider the following when operating on the jail host, this is the usual f=
low
when some services are updated:

---
# Upgrade all packages
pkg upgrade

# Restart a service that needs it
service named restart
---

If named is within a jail, the flow changes in an inconsistent way.

---
# Upgrade all packages within the dns jail
pkg -j dns upgrade

# Restart the named service within the dns jail.
# Just one of many, perhaps ezjail-admin or some other tool was used to exe=
cute
# commands within the jail.
jexec dns service named restart
---

With this patch, users can stay within the more familiar workflow of just u=
sing
the pkg and service utilities.

---
# Upgrade all packages within the dns jail.
pkg -j dns upgrade

# Restart the named service within the dns jail.
service -j dns named restart
---

The man page was updated to reflect this change and is included in the diff.

The patch to `service.sh` includes comments on was is happening around the =
-j
option, as we end up parsing the options twice.
The first time we check for `-j` and use it if we find it, the second time =
is
parsing the rest of the `service` arguments.
There may be a better way of achieving this, but my shell scripting is rust=
y.

-David

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-223325-8>