Re: [DNG] Init script for running fio as a service
On Thu, 22 Mar 2018 17:37:36 +0100 Martin Steigerwald wrote: > Hello KatolaZ. > > KatolaZ - 22.03.18, 15:40: > > On Thu, Mar 22, 2018 at 02:00:23PM +0100, Martin Steigerwald > > wrote: > […] > > > I am working on updating my fio debian package. I chose to > > > install the systemd service file for those who use a default > > > Debian system with systemd. > > > > > > However I also like to provide an init script for people who use > > > Devuan or Debian with sysvinit. > […] > > > I started a quick hack on an init script, but seems > > > start-stop-daemon does not really work as I thought it would. > > > > > > I attach my attempt to create an init script. > > > > It looks to me like you need to specify both "--server" and > > "--daemonize" as options to fio, otherwise it won't launch itself > > as a backend server. But I am not an expert of fio... > > And you are completely right. I didn´t know fio had this option. > > So I was able to shorten the init script to: > > DESC="Flexible I/O Tester as service" > DAEMON=/usr/bin/fio > DAEMON_ARGS='--server --daemonize /run/fio.pid' > PIDFILE='/run/fio.pid' > > and in the process also improve the systemd service file, I adapted > from what was in the upstream source as an example. > > Now I just need to dig out how to integrate the init script, but I > think its a simple override of dh_installinit with "--no-enable" as a > parameter. I do not want the service to run by default. > > Thanks for your remark that helped to improve that package even > further. > > BTW: I also accept other configuration files of other init, as long > as someone writes and tests them. Maybe I can go by example here and > show that it is possible to have init freedom in packages I > maintain. :) > > Thanks, I don't have a Devuan VM initted by runit, so the following info would need to be tested by someone who does. Assuming fio is to be run as root group root, which I infer from your message, the run script in the service directory looks like the following: #!/bin/sh exec /usr/bin/fio --server If your --server needs any args, they should appear after --server. DO NOT use --daemonize in runit: runit handles backgrounding by itself. Because you don't want this thing to start on boot, place an empty file called "down" inside the service directory. That way the admin will need to start up the daemon explicitly. Like I say, I don't have the setup to test this thing, but it can probably help somebody who does. HTH, SteveT Steve Litt April 2018 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Init script for running fio as a service
Hello KatolaZ. KatolaZ - 22.03.18, 15:40: > On Thu, Mar 22, 2018 at 02:00:23PM +0100, Martin Steigerwald wrote: […] > > I am working on updating my fio debian package. I chose to install the > > systemd service file for those who use a default Debian system with > > systemd. > > > > However I also like to provide an init script for people who use Devuan or > > Debian with sysvinit. […] > > I started a quick hack on an init script, but seems start-stop-daemon does > > not really work as I thought it would. > > > > I attach my attempt to create an init script. > > It looks to me like you need to specify both "--server" and > "--daemonize" as options to fio, otherwise it won't launch itself as a > backend server. But I am not an expert of fio... And you are completely right. I didn´t know fio had this option. So I was able to shorten the init script to: DESC="Flexible I/O Tester as service" DAEMON=/usr/bin/fio DAEMON_ARGS='--server --daemonize /run/fio.pid' PIDFILE='/run/fio.pid' and in the process also improve the systemd service file, I adapted from what was in the upstream source as an example. Now I just need to dig out how to integrate the init script, but I think its a simple override of dh_installinit with "--no-enable" as a parameter. I do not want the service to run by default. Thanks for your remark that helped to improve that package even further. BTW: I also accept other configuration files of other init, as long as someone writes and tests them. Maybe I can go by example here and show that it is possible to have init freedom in packages I maintain. :) Thanks, -- Martin ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Init script for running fio as a service
On Thu, Mar 22, 2018 at 02:00:23PM +0100, Martin Steigerwald wrote: > Hello. > > I am working on updating my fio debian package. I chose to install the > systemd > service file for those who use a default Debian system with systemd. > > However I also like to provide an init script for people who use Devuan or > Debian with sysvinit. Hi Martin, thanks a lot for your email and for your offer :) > > I started a quick hack on an init script, but seems start-stop-daemon does > not > really work as I thought it would. > > I attach my attempt to create an init script. > It looks to me like you need to specify both "--server" and "--daemonize" as options to fio, otherwise it won't launch itself as a backend server. But I am not an expert of fio... My2Cents KatolaZ -- [ ~.,_ Enzo Nicosia aka KatolaZ - Devuan -- Freaknet Medialab ] [ "+. katolaz [at] freaknet.org --- katolaz [at] yahoo.it ] [ @) http://kalos.mine.nu --- Devuan GNU + Linux User ] [ @@) http://maths.qmul.ac.uk/~vnicosia -- GPG: 0B5F062F ] [ (@@@) Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ ] signature.asc Description: Digital signature ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
[DNG] Init script for running fio as a service
Hello. I am working on updating my fio debian package. I chose to install the systemd service file for those who use a default Debian system with systemd. However I also like to provide an init script for people who use Devuan or Debian with sysvinit. I started a quick hack on an init script, but seems start-stop-daemon does not really work as I thought it would. I attach my attempt to create an init script. /etc/init.d/fio start: - It starts fio as a service - It starts it twice (despite what the manpage of start-stop-daemon tells) - I am using "--background" option however /etc/init.d/fio stop: - It waits for 30 seconds, although fio responds to a TERM signal immediately - It then probably sends the KILL signal to it - It stops all fio processes, even a running fio client that runs a benchmark currently (zsh: killed fio ssd-test.fio31.9%][r=0KiB/s,w=73.1MiB/s] [r=0,w=18.7k IOPS][eta 01m:02s]) Of course I like it to just start one process, and stop exactly this process. It appears to me I have to write starting and stopping of myself instead of relying on /etc/init.d/skeleton (man init-d-script). It appears to me that when daemon process does not create PID file, then start-stop-daemon does not really appear to work as advertised in its manpage. That is where I ask for help: If anyone is experienced how to write init script for this case in a reliable way, feel free to, and I include it in the packaging as an alternative to the systemd service file. Current systemd service in use: [Unit] Description=Flexible I/O Tester as service After=network.target Documentation=man:fio(1) [Service] Type=simple ExecStart=/usr/bin/fio --server Thanks, -- Martin fio Description: application/shellscript ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng