Introduction
The server controls everything you control, from devices to plugins and peripherals. The server is being build to create an ease of use by just be hot pluggable and to add devices to control wihtout any programming knowledge. The server itself needs no maintenance. Log files are being automatically rotated, and in the future will do self/device monitoring.
The manual as of this moment is not as extended as it should be, but it will help you to find your way with the server.
When you are planning attaching usb or planning on using the GPIO pins with custom devices with you’re own custom code it is needed to run the server as root as the server will do low level communications with the USB peripherals and GPIO requires root. If you are not planning to use your own custom USB devices and GPIO there is no need.
Starting/stopping and restarting the server
The server comes with a convenience script so you won’t have to type a long command line with a lot of java options to start. If you take a look in the main directory of the server you will see a couple of files which can start the server:
These all can start the server besides the ServiceInstall.bat and ServiceUninstall.bat. These are used in windows to install the server as a service in the background. The file to use to start the server is server.sh. The other file server_jmx.sh is used to monitor the server with for example jvisualvm. But these are out of scope in this manual. If you have installed the init.d script you will be using the pidome-server script
Starting/stopping with the pidome-server service script
Starting and stopping the server with the pidome-server service script is the prefered method. When this is installed (see install page). The PiDome server will start and stop automatically with every Pi boot, restart and stopped when shut down.
You can also manually control the server with this script:
- Start:
service pidome-service start
- Stop:
service pidome-service stop
- Restart:
service pidome-service restart
With the above commands all is handled for you. If you want more control over starting the server for example to start the server in debug mode read on.
Starting with the manual start and stop script
Before we go further, one command needs to be executed on the command line before the server can be started:
chmod 755 server.sh
The server has different startup modes. These include to start with debugging enabled/disabled (default), the webservice always starts.
If you are using the init script the commands are plain simple: “sudo service pidome-server start” to start, “sudo service pidome-server stop” to stop and “sudo service pidome-server restart” to restart. The init script does however NOT support a debug mode. If you need to debug the server, or are asked to run in debug mode you need to stop the server with the init script and start the server manually as described below. P.S. You can also enable/disable debugging in the web interface at: “Settings > Server settings > Debugging”.
When you have installed the init.d script you simply start the server with “sudo service pidome-server start”. This method does not have debugging options you can set at startup and is the recommended mode. To have debug at startup read on.
By default the server starts without debug logging.
sudo ./server.sh
This will start the server and put it to the background, and all output the server generates will be redirected to /dev/null (not shown on the screen). This is the preferred way to run the server.
To start the server with debugging enabled execute the following:
sudo ./server.sh debug
The above is THE preferred way as of this moment because we only have development releases. The log files grows fast, but does help us to discover any application errors if there are some. If you want to turn of debugging after started, or started without debugging and want to turn it on. Go to “Settings> server settings” in the web interface. Here is a button which toggles between debugging on or off.
Below a list of the running modes from fastest to slowest:
- sudo ./server.sh
- sudo ./server.sh debug
When the server is started, the web interface will be available at http://your.pi.ip.address:8080/.
When you look at the web interface for the first time, you will need to fill in your credentials which are username: “admin” and password: “admin” (without the double quotes(“)).
Stopping the server
When you have the server running in a background process you can go to the web interface and choose “Settings> Server settings” in the menu. The button “Shutdown server” will shut it down. If you want it to do it the hard way or you have no web interface access then you have to kill the process with or the manual script or the init script. Do the following actions:
Stopping with init script: “sudo service pidome-server stop”
Stop manually: “./server.sh kill”
Stopping the hard way:
pi@pidome-server ~/pidome-server/dist $ sudo ps x
You will see a list of processes running you will see a list like below:
pi@pidome-server ~/pidome-server/dist $ ps x PID TTY STAT TIME COMMAND 10962 ? S 0:00 /bin/bash ./server.sh debug 10965 ? Sl 3:45 java -cp ./*:./lib/*:./lib/native/*:./lib/connectors/*:./lib/connectors/dep/*:./lib/connectors/dep/native/* -Xms24m -Xmx64m -XX:PermSize=32m -XX:MaxPermSize=94m -Dlog4j.configurationFile=config/log4j2.xml 14353 ? S 0:00 sshd: pi@pts/2 14354 pts/2 Ss 0:01 -bash 14470 pts/2 R+ 0:00 ps x
The process which needs to be killed is the java process. Type:
pi@pidome-server ~/pidome-server/dist $ sudo kill -15 10965
The server is now stopped. When stopping the server the hard way you still need manually remove the process pid. This is located at “/var/run/pidome.pid”.