From owner-freebsd-bugs@freebsd.org Mon Oct 30 16:32:13 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BA81E6108E for ; Mon, 30 Oct 2017 16:32:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 080A6697E6 for ; Mon, 30 Oct 2017 16:32:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9UGWCUm005639 for ; Mon, 30 Oct 2017 16:32:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 223325] usr.sbin/service: Add support for interacting with services in jails. Date: Mon, 30 Oct 2017 16:32:12 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dor.bsd@xm0.uk X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 16:32:13 -0000 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.=