Difference between revisions of "Automatic start by using systemd"
(Created page with "The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following: <code> [Unit] Description=Aquarium Control Application After=multi-user.target [Service] Type=forking ExecStart=bash /usr/local/src/aquarium-ctrl/aquarium-ctrl-startup.sh [Install] WantedBy=multi-user.target </code>") |
|||
| (9 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following: | The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following: | ||
<code> | <code> | ||
[Unit] | [Unit] | ||
Description=Aquarium Control Application | Description=Aquarium Control Application | ||
After=multi-user.target | After=multi-user.target | ||
[Service] | [Service] | ||
Type=forking | Type=forking | ||
ExecStart=bash /usr/local/ | |||
ExecStart=bash /usr/local/bin/aquarium-ctrl-startup | |||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
</code> | |||
Upon creation/modification of the unit file, one must run the command <code>sudo systemctl daemon-reload</code> in order to activate the changes. | |||
Then, also the command <code>sudo systemctl enable aquarium-ctrl.service</code> is required to enable the service. | |||
For starting the control application manually via systemd, one can use the command <code>sudo systemctl start aquarium-ctrl.service</code>. | |||
When running the application in a configuration that utilises the relay board, the startup script needs to start the <code>screen<code> application prior to the control application in order to set the baud rate of the relay boards: | |||
<code> | |||
screen -dm /dev/ttyUSB0 19200 | |||
screen -dm /dev/ttyUSB1 19200 | |||
/usr/local/bin/aquarium-ctrl -f On -r On -u Off -d On -s On -g On -t Off -b On > /dev/null& | |||
</code> | </code> | ||
Latest revision as of 15:57, 8 April 2023
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
[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.
Then, also the command sudo systemctl enable aquarium-ctrl.service is required to enable the service.
For starting the control application manually via systemd, one can use the command sudo systemctl start aquarium-ctrl.service.
When running the application in a configuration that utilises the relay board, the startup script needs to start the screen application prior to the control application in order to set the baud rate of the relay boards:
screen -dm /dev/ttyUSB0 19200
screen -dm /dev/ttyUSB1 19200
/usr/local/bin/aquarium-ctrl -f On -r On -u Off -d On -s On -g On -t Off -b On > /dev/null&