Announcement

Collapse
No announcement yet.

(Re)Startscript of Webinterface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    (Re)Startscript of Webinterface

    Hello and greetings from Germany!

    I've installed a LMS 7.9.0 on a small linux server (eisfair-1, https://www.eisfair.org/; https://www.pack-eis.de/index.php?p=slims), but have some issues with processor load *only* when starting the LMS using the script in etc/init.d. Processor load is at 100% and stays that way.

    *BUT* when I deactivate or activate *any* plugin using the webinterface and restart using the webinterface, processor load drops immediately to "normal" under 10% (most of the time below 3%).

    So I'm asking myself (and you): How can I write a little script that (re)starts the LMS exactly like the webinterface?
    startet?

    I already know that the file "Slim/Web/Settings/Server/Plugins.pm" uses a function or routine !main::restartServer()", which probably is the subroutine "restartServer" in "slimserver.pl".

    But how can I use this subroutine in my own script?


    Thanks a lot for your help!

    René

    #2
    (Re)Startscript of Webinterface

    > So I'm asking myself (and you): How can I write a little script that
    > (re)starts the LMS exactly like the webinterface?


    There's the "restartserver" command available over CLI or JSON/RPC.

    But before you go down that route, why don't you try to fix the actual
    issue? I'm not familiar with pack-eis. But I'm pretty sure that the
    package maintainer did add some startup script which is causing
    problems. Did you get in touch with him?

    --

    Michael
    Michael

    "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
    (LMS: Settings/Information)

    Comment


      #3
      Hello Michael!

      Originally posted by mherger View Post
      > So I'm asking myself (and you): How can I write a little script that
      > (re)starts the LMS exactly like the webinterface?


      There's the "restartserver" command available over CLI or JSON/RPC.
      Sorry, but how do I use that?

      I was hoping to execute the command from a bash script or something similar.

      But before you go down that route, why don't you try to fix the actual
      issue? I'm not familiar with pack-eis. But I'm pretty sure that the
      package maintainer did add some startup script which is causing
      problems. Did you get in touch with him?
      Yes I did. The problem is: He doesn't maintain it any more / gave up last year. He still maintains eisfair itself and some packages, but doesn't use LMS on eisfair himself any more.

      Also, there are only a few people with "slow" servers having a real problem (I have an Atom 270), at others LMS seem to "only" occupy 6% to 10% without restarting via webinterface but some kind of high overall load. Well, if you have a multicore desktop CPU instead of my netbook singlecore...

      I will open another thread when I get more information from the ex-maintainer. Until then, help with the restarting is appreciated.


      Thanks in advance

      René

      Comment


        #4
        Hi,

        i dont think you have a small cpu...
        my very own cpu is a Intel Celeron M CPU 420 1.60GHz its fast enough for a standalone lms / samba Setup.
        why dont you try some debian netinstall -its not tooo hard to go that route.

        eisfair is based on Alpnine linux and thats based on musl libc and busybox ?
        Du kennst schon das Sprichwort durchs knie ins Auge schiessen?
        \edit
        "He still maintains eisfair itself and some packages, but doesn't use LMS on eisfair himself any more."
        There might be a simple reason......
        /edit

        If you need help for the Setup - you'll get it
        Last edited by DJanGo; 2016-08-11, 15:23.

        Comment


          #5
          Originally posted by DJanGo View Post
          [...]
          i dont think you have a small cpu...
          my very own cpu is a Intel Celeron M CPU 420 1.60GHz its fast enough for a standalone lms / samba Setup.
          why dont you try some debian netinstall -its not tooo hard to go that route.
          [...]
          Please don't start a "which linux distribution is best" discussion.

          I want to use eisfair because I have in the past, know it's kind of configuration, which is kind of simple and especially unified.

          (Only "eisfair-ng" is based on Alpine. I will use (and have in the past) eisfair-1, which is completely made from scratch and doesn't use any debian, ubuntu or other packages.)

          So please focus on topic which is calling the "restartserver" command from a linux script. Any help is appreciated.


          Greetings from Germany

          René

          Comment


            #6
            Originally posted by hanker View Post
            Please don't start a "which linux distribution is best" discussion.
            \snip
            /snap
            So please focus on topic which is calling the "restartserver" command from a linux script. Any help is appreciated.


            Greetings from Germany

            René
            sorry since i am a debian guy - i cant help out of the box.
            what kind of servicedemon is eisfair-1 using?

            Comment


              #7
              Originally posted by mherger View Post
              There's the inofficial "restartserver" command available over CLI or JSON/RPC.
              nice to know
              Originally posted by online help
              shutdown

              The "shutdown" command shuts down the server. The CLI connection is terminated. Note that, obviously, there is no symmetrical command to restart the server.
              Code:
              cat /var/log/squeezeboxserver/server.log
              2016-08-11 22:59:56 Logitech Media Server died. Restarting.
              @hanker: if you want to go that route - thats your way.

              Comment


                #8
                Originally posted by hanker View Post
                *BUT* when I deactivate or activate *any* plugin using the webinterface and restart using the webinterface
                sounds nice or is that webinterface something like webmin?

                Comment


                  #9
                  (Re)Startscript of Webinterface

                  >> There's the inofficial "restartserver" command available over CLI or
                  >> JSON/RPC.

                  > nice to know


                  Did I write "inofficial"?!? Well, it certainly is official. But it
                  was undocumented until yesterday. I changed that in 7.9.

                  >> shutdown
                  >>
                  >> The "shutdown" command shuts down the server. The CLI connection is
                  >> terminated. Note that, obviously, there is no symmetrical command to
                  >> restart the server.


                  This on the other hand was documented - much to my surprise. I made it
                  "deprecated", as it's only available over CLI, but not over eg.
                  JSON/RPC. You should use "stopserver" instead.

                  --

                  Michael
                  Last edited by mherger; 2016-08-12, 05:01.
                  Michael

                  "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                  (LMS: Settings/Information)

                  Comment


                    #10
                    (Re)Startscript of Webinterface

                    >> There's the "restartserver" command available over CLI or JSON/RPC.
                    >
                    > Sorry, but how do I use that?
                    >
                    > I was hoping to execute the command from a bash script or something
                    > similar.


                    You could use netcat to pipe the command to port 9090. Or something like
                    curl to post a http request.

                    But really: as you seem to be able to write bash scripts, you should be
                    able to look into why things go wrong to start with. Check the
                    server.log file for hints. Check /var/log/messages whether it's seeing
                    something odd. Try running LMS from the command line to see whether it
                    behaves the same.

                    And try to run a newer bild. That package you mentioned is more than a
                    year old.

                    And yes, that CPU you're using has plenty of power to run LMS and
                    several other server tasks. It's what I've been using since before my
                    sone was born. And he's in kindergarten now (which starts later over
                    here in Switzerland than in most places :-)).

                    --

                    Michael
                    Michael

                    "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                    (LMS: Settings/Information)

                    Comment


                      #11
                      Hello everyone!

                      Originally posted by DJanGo View Post
                      sorry since i am a debian guy - i cant help out of the box.
                      what kind of servicedemon is eisfair-1 using?
                      None.

                      slimserver.pl ist started like this:

                      - - - - - - - - - - - - - - -
                      cd ${ssdir}/
                      su - slims -s /bin/sh -c "export LANG=${def_charset}; \
                      ${ssdir}/slimserver.pl --daemon --logdir=${logdir} --prefsdir=${prefsdir} \
                      ${prefsoption} --pidfile=${pidfile} --logfile=${logfile} ${SLIMS_OPTIONS} \
                      --noimage --novideo" >> ${startlogfile} 2>> ${startlogfile}
                      - - - - - - - - - - - - - - -

                      I'm currently trying to find out what the variables actually contain in my case; "echo ${def_charset}" or "echo $def_charset" isn't helping in my case.


                      Originally posted by mherger View Post
                      [...]
                      Check /var/log/messages whether it's seeing
                      something odd. T
                      [...]
                      /var/slims/log/slimserver.log contains when (re)starting

                      - - - - - - - - - - - - - - -
                      [16-08-10 07:59:27.5010] main::init (395) Starting Logitech Media Server (v7.9.0, TRUNK, UNKNOWN) perl 5.020002
                      - - - - - - - - - - - - - - -

                      regardless of if started using the eisfair-startup-skript (100% processor load) or the "restart" option from the webinterface (which is what you see when calling http://servername:9000, BTW, sorry for my bad english). Nothing concerning slimserver at all in /var/log/messages.


                      Originally posted by mherger View Post
                      [...]
                      You could use netcat to pipe the command to port 9090. Or something like
                      curl to post a http request.
                      [...]
                      Example, *pleeeeease*?

                      Never used netcat, curl pipes before. And what http-page(?) exactly should be requested?

                      Originally posted by mherger View Post
                      [...]
                      And try to run a newer bild. That package you mentioned is more than a
                      year old.
                      [...]
                      Damn, I don't even know how to "unzip" a tarball correctly in linux and have no idea, where exactly the files are stored (which aren't always the "normal" directories in eisfair-1). And I also don't know, which package under http://downloads.slimdevices.com/nig...ex.php?ver=7.9 I have to use in eisfair-1!


                      That doesn't mean that I don't want to update or find the real problem, but my skills are really *really* limited when it comes to linux and scritping!


                      So, for now: Just a easy way to restart "using netcat to pipe the command to port 9090 or something like curl to post a http request", please?



                      Lieber Gruß, thank you very much

                      René

                      Comment


                        #12
                        (Re)Startscript of Webinterface

                        > Example, *pleeeeease*?

                        curl -X POST -d
                        '{"id":0,"params":["",["restartserver"]],"method":"slim.request"}'


                        The last part must be your server's URL. the important part is the json
                        data sent: inside the "params" array you'd send commands as defined in
                        the CLI documentation (http://yourserver:9000/html/docs/cli-api.html).
                        The first element would be a player's MAC address for commands which
                        require a player. The inner array would be the command and its
                        parameters. "restartserver" doesn't require any parameter at all.

                        > Damn, I don't even know how to "unzip" a tarball correctly in linux and


                        tar xzf logitechmediaserver-7.9.0-9999999999-noCPAN.tgz

                        > have no idea, where exactly the files are stored (which aren't always
                        > the "normal" directories in eisfair-1). And I also don't know, which


                        RTFM :-P. From the page you pointed to you can reach the packages
                        documentation which gives some hints:



                        > package under http://downloads.slimdevices.com/nig...ex.php?ver=7.9


                        The noCPAN variety might be good enough.

                        > That doesn't mean that I don't want to update or find the real problem,
                        > but my skills are really *really* limited when it comes to linux and
                        > scritping!


                        Once you've figured your way around the startup parameter I'd suggest
                        you check whether running them manually would result in the same CPU
                        load issue. Did you ever check which exact process was eating your CPU?

                        --

                        Michael
                        Michael

                        "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                        (LMS: Settings/Information)

                        Comment


                          #13
                          Originally posted by hanker View Post
                          /var/slims/log/slimserver.log contains when (re)starting

                          - - - - - - - - - - - - - - -
                          [16-08-10 07:59:27.5010] main::init (395) Starting Logitech Media Server (v7.9.0, TRUNK, UNKNOWN) perl 5.020002
                          - - - - - - - - - - - - - - -
                          I would use all my rtfm to eg this and install at least Perl 5.8. Thats old but i found a hint to a package - may there are newer ones.


                          Originally posted by hanker View Post
                          Please don't start a "which linux distribution is best" discussion.
                          TBH - There is no discussion - what linux distribution is best "supported" here. Its mostly only one and its childs/forks.
                          Last edited by DJanGo; 2016-08-12, 08:41.

                          Comment


                            #14
                            (Re)Startscript of Webinterface

                            >> - - - - - - - - - - - - - - -
                            >> [16-08-10 07:59:27.5010] main::init (395) Starting Logitech Media Server
                            >> (v7.9.0, TRUNK, UNKNOWN) *perl 5.020002*
                            >> - - - - - - - - - - - - - - -

                            >
                            > I would use all my rtfm to eg 'this'
                            > (http://lists.spline.de/pipermail/eis...ry/007885.html) and
                            > install at least Perl 5.8. Thats old but i found a hint to a package -
                            > may there are never ones.


                            You should read up on Perl and you'd understand that this is Perl 5.20
                            ;-). 5.8 is the minimum required for LMS.

                            --

                            Michael
                            Michael

                            "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                            (LMS: Settings/Information)

                            Comment


                              #15
                              @Michael: uuuuups...


                              Hallo Stefan,
                              manchmal hängt sich der Slimserver auf, wenn man ihm bestimmte Dateien
                              während des Betriebs unter den Füßen wegzieht. Du solltest erst mit
                              "/etc/init.d/slims stop" den Prozess stoppen und dann mit "ps -ef| grep
                              "slims"" schauen, ob noch bestimmte Teile laufen. Falls ja, gilt es
                              diese Prozesse manuell mittels kill-Befehl zu beenden.

                              Anschließend mit "/etc/init.d/slims start" bzw. "/etc/init.d/slims
                              -debug start" wieder starten. Die zweite Startvariante sollte mehr
                              Fehlermeldungen ausgeben.

                              Comment

                              Working...
                              X