Saturday, March 10, 2012

systemd-qserv

This is an interactive script that can handle most of the task regarding systemd services. It is just a front end for systemctl and not a replacement. What it does is it make's your life easier by avoiding to type extension '*.service' again and again  while dealing with services. Imagine if you want to stop at least 4 services at once, hence you will type 'systemctl stop one.service two.service three.service four.service' , you need to type additional eight  characters on each service names  which means 32 characters long! Systemd-qserv will allow you to enter just their names without an extension '*.service or even a mix of like 'apache2 sshd msyql xinetd.service nfs.service' would be just fine.

So why did it came up in OBS? while other scripts that are well written did not end up in OBS? first of all kudos to Boris Manojlovic for packaging this stuff. Now to answer the question, most of the script's that are out there is specific to just one application. Come openSUSE 12.1 systemd is the default whether you like it or not and it does not care what DE do you use or if you even use one at all. You can find the package in my home repo.  The source is there too.



snapshot.






















This is an example of running qserv.sh directly as a normal user. and trying to stop some services.


























 As you can see normal user can run the script since it is only a front-end to systemctl but stopping service or services will be done by systemctl itself and this script has no control over systemd's systemctl!



























Now for those of you who shun systemd-qserv you can do some tricks to avoid repeating *.service again and again. Here's an example.

 systemctl start {apache2,sshd,mysql,nfs,cifs,cups,vboxdrv,postgresql}.service 

The above code is equivalent to:

 systemctl start apache2.service sshd.service mysql.service nfs.service vboxdrv.service postgresql.service 

This works on a bash shell which is the default for openSUSE, if you change your shell, then you probably know what you are doing so have fun doing the same with your current shell :-)

Just try it sometime folks.

3 comments:

  1. Really helpful script, thanks bro.

    I have one suggestion, instead of typing the service names, show them in a numbered list format and then the user only has to enter the number of the service to start or stop.

    ReplyDelete
  2. Will look into it bro, thanks for the comment!

    ReplyDelete
  3. Also that feature you can find in yast/yast2 :-)

    ReplyDelete