Server Restart Option

Would like to see a 'Server Restart' option in the Cog dropdown menu just above the Logout. Also add this as a permission in the User Accounts so we can disable that option from users. This would make it easier to restart the server while using the web ui remotely.

Comments

  • This is already possible. See manual -> Advanced Setup. It describes how to reboot or shutdown pi. Same method can also be used to restart the server service.
  • Reading that document states that it would allow possible hacking and its not a secure way. I don't mind using a script as long as it can be set up to be used by approved users.

    If not, then having it built into the server with user access limited to those approved would be the only other option that I can think of.
  • What I meant is that everyone with access to server can run it, but since it is not configurable from server it is safe. I mean it only restarts the server so it is all they can do. Also you can add a confirm dialog and set required user permission so it is as safe as it can be. Making it editable from internet would make it insecure.
  • Maybe I am getting a bit confused here, not explaining the request or just not understanding what you mean by using a script. So I will try to better clarify the request along with trying to clarify my understanding of the script that was mentioned.

    What I am looking for is an addition to the User Profile (within Rep-Server) in the Edit Profile window to allow for selected profiles the ability to restart the daemon (service). I don't want the hardware restarted, just the daemon (service). Since I am not well versed in scripting within Ubuntu, I am making a guess that different OS versions would use different scripts to restart the Daemon service for Rep-Server. I believe this variety of script differences could be resolved by adding a Script section in Global Settings allowing an Administrator user in Rep-Server to be able to edit the script to fit the OS version they are using. Then that script would show up as an option in the Edit Profile window.

    Now for my confusion on the information about a script that you recommended. I am not sure where within Rep-Server you can place a script. I read the document and I am making a guess that what is being recommended is making an OS side script outside of Rep-Server. That is not what my request involves. If I had to run the script from within the OS, then I wouldn't need a script since I could just as easily reboot the server if needed.

    The whole point of the request is to have a quick and easy way to remotely restart the Rep-Server daemon while I am not near the equipment. Or in between prints, quickly restart the daemon to refresh the Rep-Server.

    Hope that helps in clarifying the request... sometimes I have an idea in the mind and just can't get it across in my text.
  • Ok, so I understood you correctly:-)

    extcommands.xml is to be placed in storage database directory, on linux /var/lib/Repetier-Server/database.
    The command for restarting server is
    /usr/bin/sudo service  service RepetierServer restart
    Here the correct example from docs with hidden parts:

    <config>
    	<!--
           If you want to run external commands, enter them in this configuration with
           full path. You will see them in the main menu. Copy this file into the
           <storage>/database directory.
    
           Security consideration: The reason there is no online editor for this is simply
           security. The commands you enter here are executed with the privileges of the
           daemon running the server. If you would allow online configuration, a hacker could
           simply add any command he needs to hack your system.
    
    	     Commands are normally visible in the global menu. If you want one to appear only in
    	     in the printer menu, add the attribute "slugname" to command. You see the slugname
    	     when you select a printer as part of the path.
        -->
    	<command>
    		<name>Shutdown Server</name>
    		<execute>sudo /sbin/shutdown -h now</execute>
    		<confirm>Really shut down the server?</confirm>
    	    <!-- Define if command should show up in local printer interface, default true.-->
    		<local>true</local>
    	    <!-- Define if command should show up in remote printer interface, default true.-->
    		<remote>true</remote>
    	    <!-- Define if command should show up only for users with print permission, default true.-->
    		<print-permission>true</print-permission>
    	    <!-- Define if command should show up only for users with add files permission, default false.-->
    		<add-permission>true</add-permission>
    	    <!-- Define if command should show up only for users with del files permission, default false.-->
    		<del-permission>true</del-permission>
    	    <!-- Define if command should show up only for users with configuration permission, default false.-->
    		<config-permission>true</config-permission>
    	</command>
    	<command>
    		<name>Reboot Server</name>
    		<execute>sudo /sbin/shutdown -r now</execute>
    		<confirm>Really reboot the server?</confirm>
    	</command>
    
    	<!--
            G-code files can contain
            @execute cmd param1 param2
            commands. To prevent external users from executing unwanted or dangerous commands,
            only commands defined here are allowed to execute. More over, only the shortcuts
            defined here are to be used as cmd in @execute. Prevent parameter where ever possible.
        -->
    	<execute name="play" allowParams="true">/usr/bin/afplay</execute><!-- play the sound file on moc os x -->
    </config>
    
    As you see you can exactly where and for which user permissions it should appear.
    Just make sure user repetierserver can start sudo without password prompt.
  • Thanks! I will try this and let you know how it went. I believe I already gave repetierserver the permission to start sudo without password prompt.
  • Worked like a charm. Now only users with Configuration permissions can restart the server. Thanks!
Sign In or Register to comment.