Posted on

Raspberry Pi – Running Spy Server as a service

 

  • Updated 26/3/18 to correct typo in Unit file

The excellent Airspy Spy Server can easily be used as a service using SYSTEMD under Linux. This is a much better way to autostart the server as it gives you the facility to stop/start/check status of the server at any time. I’ve used this facility in my latest Spy Server SD card (to be released very soon!) so you can switch between receiver types without having to reboot the Pi.

Running Spy Server as a Service

The first step is to create a new file called spyserver.service and save it in /etc/systemd/system/.

The simplest way to do this is using nano as follows:

sudo nano /etc/systemd/system/spyserver.service

Now enter the following text into the file and save it (Ctl x y Enter):

[Unit]

Description=Spy Server

After=network.target

[Service]

ExecStart=/home/pi/./spyserver spyserver.config

WorkingDirectory=/home/pi/

StandardOutput=inherit

StandardError=inherit

Restart=always

User=pi

[Install]

WantedBy=multi-user.target


You can now start, stop and check the status of Spy Server with the following commands:

sudo systemctl start spyserver.service

sudo systemctl stop spyserver.service

sudo systemctl status spyserver.service

The following command will activate the service to automatically start at boot time:

sudo systemctl enable spyserver.service

That’s it!

Mike – G4WNC

2 thoughts on “Raspberry Pi – Running Spy Server as a service

  1. Thanks a lot for the page Raspberry Pi – Running Spy Server as a service
    its working great with Ayrspy mini on a Raspberry Pi 3 +

    for me it did not autostart the service until i googled and found there is an error
    on your page

    wantedBy=multi-user.target must be WantedBy=multi-user.target

    nice work thank you

    1. Hi Fernando,

      Glad you’ve found it useful and thanks for spotting that typo. I’ll correct it now.

      Mike – G4WNC

Leave a Reply

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