From owner-freebsd-hackers@freebsd.org Wed Sep 16 13:48:10 2015 Return-Path: Delivered-To: freebsd-hackers@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 A51319CE84D for ; Wed, 16 Sep 2015 13:48:10 +0000 (UTC) (envelope-from j.deboynepollard-newsgroups@ntlworld.com) Received: from know-smtprelay-omc-1.server.virginmedia.net (know-smtprelay-omc-1.server.virginmedia.net [80.0.253.65]) by mx1.freebsd.org (Postfix) with ESMTP id 0EAF01275 for ; Wed, 16 Sep 2015 13:48:09 +0000 (UTC) (envelope-from j.deboynepollard-newsgroups@ntlworld.com) Received: from [192.168.1.100] ([86.10.211.13]) by know-smtprelay-1-imp with bizsmtp id Hpmz1r0030HtmFq01pmzqb; Wed, 16 Sep 2015 14:46:59 +0100 X-Originating-IP: [86.10.211.13] X-Spam: 0 X-Authority: v=2.1 cv=AJvf2gUA c=1 sm=1 tr=0 a=SB7hr1IvJSWWr45F2gQiKw==:117 a=SB7hr1IvJSWWr45F2gQiKw==:17 a=NLZqzBF-AAAA:8 a=IkcTkHD0fZMA:10 a=0_P6uxvq3zfHrrkiHTwA:9 a=QEXdDO2ut3YA:10 a=XdyKOaxJwVsA:10 a=A_Ij85UXA3UA:10 a=IUCpGYfEpY0A:10 a=ouB9RdVhKGoA:10 a=aroVJyLFwIsA:10 a=YXNy2nbAtK8A:10 To: timp87@gmail.com, FreeBSD Hackers References: CAAoTqfvxUznJp+tguAaYQ=5HfKXTG+GxY644wvqm4e9=E8WuHw@mail.gmail.com From: Jonathan de Boyne Pollard Subject: Re: How to control and setup service? Message-ID: <55F972BF.8070302@NTLWorld.com> Date: Wed, 16 Sep 2015 14:46:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 13:48:10 -0000 Pavel Timofeev: > As a user I would love to have a cool tool to control and configure > services in way like OpenBSD's rcctl(8) does As long as you are prepared to live with replacing those rc.d scripts, you have almost exactly that already available. Here are some example commands illustrating that and various other shims that are available. (Yes, there is in fact a mysql service bundle supplied.) # system-control enable mysql cyclog@mysql # systemctl enable mysql cyclog@mysql # initctl enable mysql cyclog@mysql # svcadm enable mysql cyclog@mysql # rcctl enable mysql cyclog@mysql # system-control start mysql cyclog@mysql # systemctl start mysql cyclog@mysql # initctl start mysql cyclog@mysql # svcadm start mysql cyclog@mysql # service mysql start ; service cyclog@mysql start # system-control status mysql # systemctl status mysql # initctl status mysql # svcadm status mysql # rcctl status mysql # system-control is-enabled mysql # systemctl is-enabled mysql # initctl is-enabled mysql # svcadm is-enabled mysql # system-control set-service-env tinydns IP 127.53.0.1 # rcctl set tinydns IP 127.53.0.1 # system-control print-service-env dnscache # rcctl get dnscache And here are where you go next: * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh.html * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh/freebsd-binary-packages.html * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh/timorous-admin-installation-how-to.html * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh/worked-example.html * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh/commands.html#ControlStatus * http://homepage.ntlworld.com./jonathan.deboynepollard/Softwares/nosh/roadmap.html#FreeBSDrc.d Read. Enjoy. Any contributions towards whittling away the remaining rc.d scripts on that list welcomed. If you want to try out flow capture, take a file named flow-capture.service containing > [Unit] > Description=%p daemon for capturing traffic flow data > > [Service] > User=%p > EnvironmentDirectory=env >ExecStart=%p $flags ${datadir:+-w} $datadir "$localip/$remoteip/$port" > > [Install] >WantedBy=workstation.target and run it through # system-control convert-systemd-units --bundle-root /var/local/sv/ --no-systemd-quirks ./flow-capture.service Then experiment with # pw useradd flow-capture # rcctl set flow-capture flags "-e 2200 -n 23 -N 0 -V 5" # rcctl set flow-capture datadir "/storage/flows/all_routers" # rcctl set flow-capture port "8787" # rcctl set flow-capture localip "0" # rcctl set flow-capture remoteip "0" # rcctl get flow-capture # system-control cat flow-capture # rcctl enable flow-capture # systemctl start flow-capture # system-control status flow-capture