Add systemd scripts for cluster mode

This commit is contained in:
Vasily Evseenko 2024-10-03 00:21:38 +03:00
parent cd9153c91a
commit 0d683a160f
9 changed files with 73 additions and 5 deletions

2
debian/postinst vendored Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
systemctl daemon-reload

5
debian/postrm vendored Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
if [ "$1" == "remove" ]
then
systemctl daemon-reload
fi

6
debian/prerm vendored Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
if [ "$1" == "remove" ]
then
systemctl stop wifibroadcast
systemctl stop wfb-cluster
fi

View File

@ -0,0 +1,17 @@
[Unit]
Description=WFB-ng cluster manager, profile %i
Requires=wfb-cluster.service
ReloadPropagatedFrom=wfb-cluster.service
[Service]
Type=simple
ExecStart=/bin/bash -c "exec /usr/bin/wfb-server --profiles $(echo %i | tr : ' ') --cluster manual"
TimeoutStopSec=5s
KillMode=mixed
Restart=on-failure
RestartSec=5s
# Set logging to file in wifibroadcast.cfg
StandardError=inherit
[Install]
WantedBy=wfb-cluster.service

View File

@ -0,0 +1,16 @@
[Unit]
Description=WFB-ng cluster node
Requires=wfb-cluster.service
ReloadPropagatedFrom=wfb-cluster.service
[Service]
Type=simple
ExecStart=/usr/sbin/wfb-ng.sh
TimeoutStopSec=5s
Restart=on-failure
KillMode=mixed
RestartSec=5s
StandardError=inherit
[Install]
WantedBy=wfb-cluster.service

View File

@ -0,0 +1,17 @@
# This is a mostly empty service, but allows commands like stop, start, reload
# to propagate to all wfb-cluster services instances.
[Unit]
Description=WFB-ng cluster
After=network.target
Conflicts=wifibroadcast.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
[Install]
WantedBy=multi-user.target

View File

@ -2,8 +2,9 @@
# to propagate to all wifibroadcast@ service instances.
[Unit]
Description=Wifibroadcast server
Description=WFB-ng standalone server
After=network.target
Conflicts=wfb-cluster.service
#After=network.target sys-subsystem-net-devices-wlx00c0caa578a9.device
#Requires=sys-subsystem-net-devices-wlx00c0caa578a9.device

View File

@ -1,6 +1,6 @@
[Unit]
Description=WFB profile %i
PartOf=wifibroadcast.service
Description=WFB-ng standalone server, profile %i
Requires=wifibroadcast.service
ReloadPropagatedFrom=wifibroadcast.service
[Service]
@ -10,10 +10,11 @@ EnvironmentFile=/etc/default/wifibroadcast
# per-profile environment
EnvironmentFile=-/etc/default/wifibroadcast.%i
ExecStart=/bin/bash -c "exec /usr/bin/wfb-server --profiles $(echo %i | tr : ' ') --wlans ${WFB_NICS}"
KillMode=mixed
TimeoutStopSec=5s
Restart=on-failure
RestartSec=5s
# Set logging to file in wifibroadcast.cfg
# Set logging to file in /etc/wifibroadcast.cfg
StandardError=inherit
[Install]

View File

@ -50,7 +50,10 @@ setup(
package_data={'wfb_ng.conf': ['master.cfg', 'site.cfg']},
data_files = [('/usr/bin', ['wfb_tx', 'wfb_rx', 'wfb_keygen', 'wfb_tx_cmd', 'scripts/wfb-cli-x11']),
('/lib/systemd/system', ['scripts/wifibroadcast.service',
'scripts/wifibroadcast@.service']),
'scripts/wifibroadcast@.service',
'scripts/wfb-cluster.service',
'scripts/wfb-cluster-node.service',
'scripts/wfb-cluster-manager@.service']),
('/etc/default', ['scripts/default/wifibroadcast']),
('/etc/sysctl.d', ['scripts/98-wifibroadcast.conf']),
('/etc/logrotate.d', ['scripts/wifibroadcast'])] if install_data_files else [],