fixed systemd unit issues
This commit is contained in:
parent
14dd229abd
commit
43a35283db
10
install.sh
10
install.sh
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# force run from root user
|
# force run from root user
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
exec sudo "$0" "$@"
|
exec sudo "$0" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -17,9 +17,9 @@ mkdir -p /etc/systemd/system
|
||||||
|
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/chat" > /etc/ppp/chatscripts/sim800c
|
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/chat" > /etc/ppp/chatscripts/sim800c
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/peer" > /etc/ppp/peers/sim800c
|
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/peer" > /etc/ppp/peers/sim800c
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/script" > /etc/init.d/sim800c.sh
|
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/script" > /etc/init.d/sim800c
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/service" > /etc/systemd/system/sim800c.service
|
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/service" > /etc/systemd/system/sim800.service
|
||||||
|
|
||||||
chmod +x /etc/init.d/sim800c
|
chmod +x /etc/init.d/sim800c
|
||||||
systemctl enable sim800c
|
systemctl enable sim800
|
||||||
systemctl start sim800c
|
systemctl start sim800
|
||||||
|
|
|
||||||
4
script
4
script
|
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# /etc/init.d/sim800c.sh
|
# /etc/init.d/sim800c
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "AT+CFUN=1,1" > /dev/ttyS3
|
echo "AT+CFUN=1,1" > /dev/ttyS3
|
||||||
|
sleep 3
|
||||||
echo "AT+IPR=115200" > /dev/ttyS3
|
echo "AT+IPR=115200" > /dev/ttyS3
|
||||||
pon sim800c
|
pon sim800c
|
||||||
;;
|
;;
|
||||||
|
|
@ -14,6 +15,7 @@ stop)
|
||||||
# echo "+++" > /dev/ttyS3
|
# echo "+++" > /dev/ttyS3
|
||||||
# sleep 3
|
# sleep 3
|
||||||
echo "AT+CFUN=1,1" > /dev/ttyS3
|
echo "AT+CFUN=1,1" > /dev/ttyS3
|
||||||
|
sleep 3
|
||||||
;;
|
;;
|
||||||
restart|reload)
|
restart|reload)
|
||||||
$0 stop
|
$0 stop
|
||||||
|
|
|
||||||
6
service
6
service
|
|
@ -1,4 +1,4 @@
|
||||||
# /etc/systemd/system/sim800c.service
|
# /etc/systemd/system/sim800.service
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=SIM800C PPP Connection
|
Description=SIM800C PPP Connection
|
||||||
|
|
@ -7,8 +7,8 @@ After=rc-local.service
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/run/ppp0.pid
|
PIDFile=/run/ppp0.pid
|
||||||
ExecStart=/etc/init.d/sim800c.sh start
|
ExecStart=/etc/init.d/sim800c start
|
||||||
ExecStop=/etc/init.d/sim800c.sh stop
|
ExecStop=/etc/init.d/sim800c stop
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user