SharkRF connector server: web interface and auto start RF server

I wanted to get the SharkRF web page up on my SharkRF Connector Server and auto-start the SharkRF service. In addition, I wanted the service to not run as a sudoer (administrator). I’ve documented my setup below.

Change log

Original – 18 January 2018
REV 1 – 19 January 2018 – Added lines 6, 7, 8, 10. Added reference to Github. Added external URL for Apache2 directory modification. Added step for copying
REV 1.1 – 21 January 2018 – Added lines 13, 13(1), and 14.
REV 1.2 – 21 January 2018 – edited content for flow (thanks @Dano3131)


  • You will need Apache2 and PHP installed for this deployment.
    Follow this guide just don’t install MySQL.
  • Once Apache2 is installed, you will need to change your Apache2 default directory (if you followed my compile post) to /var/sharkrf/srf-ip-conn-srv/dashboard


Next, we want to auto start the RF server service and not run as root. We also want to set proper directory permissions.

  1. adduser sharkservice
    1. Set password, skip the remaining questions
  2. cd /var/sharkrf/srf-ip-conn-srv/dashboard/
  3. cp
  4. cd /var/sharkrf/srf-ip-conn-srv
  5. cp config-example.json build/Release/
  6. cd /var/sharkrf/srf-ip-conn-srv/build/Release
  7. mv config-example.json config.json
  8. chmod 755 config.json
    1. This will make the config.json file the same perms as the srf-ip-conn-srv binary. Edit config.json according to the Github install instructions.
  9. cd /var
  10. chown sharkservice:sharkservice sharkrf -R
  11. cd /var/sharkrf/srf-ip-conn-srv
  12. chown www-data:www-data dashboard -R
  13. nano /etc/apache2/sites-enabled/000-default.conf
    1. Change “DocumenRoot /var/www/html” to DocumentRoot /var/sharkrf/srf-ip-conn-srv/dashboard/
  14. service apache2 restart

Next we want to make sure that our service starts as our “sharkservice” user.

  1. su sharkservice
  2. cd /var/sharkrf/srf-ip-conn-srv/build/Release
  3. ./srf-ip-conn-srv -f

At this point you should see the service running as your service account. Navigate to your server in a web browser on port 80. You should also see your server details in the web page. Go ahead and CTRL+C that (killing the program).

  1. crontab -e
  2. Put in this command exactly. This will start your program upon a server reboot: @reboot /var/sharkrf/srf-ip-conn-srv/build/Release/srf-ip-conn-srv -c /var/sharkrf/srf-ip-conn-srv/build/Release/config.json
    1. If you don’t explicitly include -c and the full path to the config.json file then the program will never run. Digging through the syslog file you would find “path to config.json not found” on reboot when the system tries to start the program.
  3. Add an extra line after your command in crontab (just put the command in and press enter again) then save crontab.
  4. exit
  5. shutdown -r now

At this point your server should reboot, the web page should throw errors. Once the server comes back up your web page can be refreshed, the errors should go away and you should see your RF server details.

Bam! Auto start program under a non sudoer and displaying your RF server in an Apache web page.

Couldn’t be easier. (<– I say that but it took me about 4 hours to figure out this 10 minute post).


Related: Preconfigured SharkRF VMX and VMDK
Related: Setting up the SharkRF server on Ubuntu Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × 5 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.