Raspberry Service designen

Am Beispiel von WPA-Ping (wird von mir NICHT genutzt)

Das Script sieht so aus:

cat >> /usr/local/bin/wpaping << "EOFWPA"
#!/bin/bash
#
# Loop forever doing wpa_cli SCAN commands
#

sleeptime=120  # number of seconds to sleep. 2 minutes (120 seconds) is a good value

while [ 1 ];
do
    wpa_cli -i wlan0 scan
    sleep $sleeptime
done

EOFWPA

Der Service selber wird so gestaltet:

cat >> /lib/systemd/system/wpaping.service << "EOFWPA"
[Unit]
Description=WPA Supplicant pinger
Requires=network-online.target

[Service]
ExecStart=/usr/local/bin/wpaping
User=root
StandardInput=null
StandardOutput=null
StandardError=null
Restart=on-failure

[Install]
WantedBy=multi-user.target

EOFWPA

Um den Service dauerhaft zu starten, einfach den Standard-Weg beschreiten:

systemctl daemon-reload; systemctl enable wpaping.service; systemctl start wpaping.service

Runlevel herausfinden:

runlevel


KategorieRaspberry

Raspberry Service designen (zuletzt geƤndert am 2020-11-17 13:28:05 durch HansStefanSuhle)