Close

Run as a Service

A project log for DSKY

Create a working DSKY using a 3D printer and my AGC simulator running on a Raspberry Pi and slave Arduino Nanos.

wglasfordwglasford 07/17/2022 at 21:050 Comments

To make this a stand-alone DSKY you need to run the two processes (DSKY and AGC simulator) as services.  This is fairly simple on a UNIX variant, in this case I am using Rasbian, the default OS for a Raspberry Pi.  Start by running as root and cd to /etc/systemd/system.  Now copy the two files I have out on Git hub named AGC.service and DSKY.service.  To auto run the AGC you will also need a file named command.file.  I placed this file in /home/pi/virtualagc/yaAGC but you can place it just about anywhere and name it almost anything.  The important thing is that it contains a single line with the text "run".  Here is the AGC.service text.

 After=multi-user.target

[Service]

  Type=idle

  WorkingDiretory=/home/pi/virttualagc/yaAGC

  ExecStart=/home/pi/virtualagc/yaAGC/yaAGC ../Luminary131/Luminary131.bin --command=/home/pi/virtualagc/yaAGC/command.file

[Install]

  WantedBy=multi-user.target

The description is simply a name you give this service. 

Now that you have the two services in place, you need to reload the daemon.

> systemctl daemon-reload

Now enable both services.

> systemctl enable AGC.service

> systemctl enable DSKY.service

Now every time you reboot the two services will start and the DSKY will fire up and you can start using it right away.  If you don't want to reboot you can start them by using the following commands.

> systemctl start AGC.service

> systemctl start DSKY.service

You can also stop the services in a similar way.

> systemctl stop DSKY.service

> systemctl stop AGC.service

Discussions