Automatic start by using systemd: Difference between revisions
(Automatic start of main control application by using systemd) |
No edit summary |
||
| Line 28: | Line 28: | ||
<code> | <code> | ||
#!/bin/bash | #!/bin/bash | ||
# Creating message queues for operation or test of aquarium_control | # Creating message queues for operation or test of aquarium_control | ||
sudo touch /dev/mqueue/aquarium_control.5UXp | sudo touch /dev/mqueue/aquarium_control.5UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.5UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.5UXp | ||
sudo touch /dev/mqueue/aquarium_control.4UXp | sudo touch /dev/mqueue/aquarium_control.4UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.4UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.4UXp | ||
sudo touch /dev/mqueue/aquarium_control.6UXp | sudo touch /dev/mqueue/aquarium_control.6UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.6UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.6UXp | ||
sudo touch /dev/mqueue/aquarium_control.7UXp | sudo touch /dev/mqueue/aquarium_control.7UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.7UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.7UXp | ||
sudo touch /dev/mqueue/aquarium_control.8UXp | sudo touch /dev/mqueue/aquarium_control.8UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.8UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.8UXp | ||
sudo touch /dev/mqueue/aquarium_control.9UXp | sudo touch /dev/mqueue/aquarium_control.9UXp | ||
sudo chmod o+rwx /dev/mqueue/aquarium_control.9UXp | sudo chmod o+rwx /dev/mqueue/aquarium_control.9UXp | ||
/usr/local/bin/aquarium_control > /dev/null& | /usr/local/bin/aquarium_control > /dev/null& | ||
</code> | </code> | ||
Only one of the message queues is required for operating the control application. The other message queues are use for parallel SW unit testing. | |||
Revision as of 08:42, 30 December 2024
The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following:
[Unit]
Description=Aquarium Control Application
After=multi-user.target
[Service]
Type=forking
ExecStart=bash /usr/local/bin/aquarium-ctrl-startup.sh
[Install]
WantedBy=multi-user.target
Upon creation/modification of the unit file, one must run the command sudo systemctl daemon-reload in order to activate the changes.
For starting the control application manually via systemd, one can use the command sudo systemctl start aquarium-ctrl.
The startup script creates a set of POSIX message queues and sets their access rights before starting the control application to run in the background.
- !/bin/bash
- Creating message queues for operation or test of aquarium_control
sudo touch /dev/mqueue/aquarium_control.5UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.5UXp
sudo touch /dev/mqueue/aquarium_control.4UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.4UXp
sudo touch /dev/mqueue/aquarium_control.6UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.6UXp
sudo touch /dev/mqueue/aquarium_control.7UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.7UXp
sudo touch /dev/mqueue/aquarium_control.8UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.8UXp
sudo touch /dev/mqueue/aquarium_control.9UXp
sudo chmod o+rwx /dev/mqueue/aquarium_control.9UXp
/usr/local/bin/aquarium_control > /dev/null&
Only one of the message queues is required for operating the control application. The other message queues are use for parallel SW unit testing.