How to control and setup service?

Jonathan de Boyne Pollard J.deBoynePollard-newsgroups at NTLWorld.com
Wed Sep 16 13:48:10 UTC 2015


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 at mysql
# systemctl enable mysql cyclog at mysql
# initctl enable mysql cyclog at mysql
# svcadm enable mysql cyclog at mysql
# rcctl enable mysql cyclog at mysql

# system-control start mysql cyclog at mysql
# systemctl start mysql cyclog at mysql
# initctl start mysql cyclog at mysql
# svcadm start mysql cyclog at mysql
# service mysql start ; service cyclog at 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



More information about the freebsd-hackers mailing list