deleted all old files
This commit is contained in:
parent
33d22addae
commit
4a3dd55873
33
README.md
33
README.md
|
|
@ -1,33 +0,0 @@
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
### Ubuntu
|
|
||||||
```SHELL
|
|
||||||
sudo apt remove -y inetutils-ping
|
|
||||||
sudo apt install -y ppp iputils-ping
|
|
||||||
```
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
### Ubuntu
|
|
||||||
```SHELL
|
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/install.sh" | bash
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage (via systemd unit)
|
|
||||||
|
|
||||||
- Start & enable on startup
|
|
||||||
```SHELL
|
|
||||||
sudo systemctl start sim800-healthcheck.timer
|
|
||||||
sudo systemctl enable sim800-healthcheck.timer
|
|
||||||
```
|
|
||||||
|
|
||||||
- Stop & disable on startup
|
|
||||||
```SHELL
|
|
||||||
sudo systemctl stop sim800-healthcheck.timer
|
|
||||||
sudo systemctl disable sim800-healthcheck.timer
|
|
||||||
```
|
|
||||||
|
|
||||||
- Restart immediately
|
|
||||||
```SHELL
|
|
||||||
sudo systemctl restart sim800
|
|
||||||
```
|
|
||||||
10
chat
10
chat
|
|
@ -1,10 +0,0 @@
|
||||||
# /etc/ppp/chatscripts/sim800c
|
|
||||||
|
|
||||||
TIMEOUT 15
|
|
||||||
ABORT "BUSY"
|
|
||||||
ABORT "ERROR"
|
|
||||||
ABORT "NO CARRIER"
|
|
||||||
"" AT
|
|
||||||
OK "AT+CGDCONT=1,\"IP\",\"internet.beeline.ru\""
|
|
||||||
OK ATD*99#
|
|
||||||
CONNECT ""
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# /etc/systemd/system/sim800-healthcheck.service
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=SIM800 Healthcheck service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/etc/init.d/sim800c healthcheck
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
# /etc/systemd/system/sim800-healthcheck.timer
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=SIM800 healthcheck timer
|
|
||||||
After=rc-local.service
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=2min
|
|
||||||
OnUnitActiveSec=2m
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
26
install.sh
26
install.sh
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# force run from root user
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
exec sudo "$0" "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
apt update
|
|
||||||
apt remove -y inetutils-ping
|
|
||||||
apt install -y ppp curl iputils-ping
|
|
||||||
|
|
||||||
mkdir -p /etc/ppp/chatscripts
|
|
||||||
mkdir -p /etc/ppp/peers
|
|
||||||
mkdir -p /etc/init.d
|
|
||||||
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/peer" > /etc/ppp/peers/sim800c
|
|
||||||
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/sim800.service
|
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/healthcheck-service" > /etc/systemd/system/sim800-healthcheck.service
|
|
||||||
curl -sSL "https://git.openergy.ru/LUCKFOX/SIM800C/raw/branch/main/healthcheck-timer" > /etc/systemd/system/sim800-healthcheck.timer
|
|
||||||
|
|
||||||
chmod +x /etc/init.d/sim800c
|
|
||||||
23
peer
23
peer
|
|
@ -1,23 +0,0 @@
|
||||||
# /etc/ppp/peers/sim800c
|
|
||||||
|
|
||||||
/dev/ttyS3
|
|
||||||
115200
|
|
||||||
|
|
||||||
debug
|
|
||||||
# nodetach
|
|
||||||
dump
|
|
||||||
lock
|
|
||||||
|
|
||||||
defaultroute
|
|
||||||
replacedefaultroute
|
|
||||||
defaultroute-metric 200
|
|
||||||
|
|
||||||
nocrtscts
|
|
||||||
ipcp-accept-local
|
|
||||||
ipcp-accept-remote
|
|
||||||
noipdefault
|
|
||||||
usepeerdns
|
|
||||||
persist
|
|
||||||
noauth
|
|
||||||
|
|
||||||
connect '/usr/sbin/chat -v -f /etc/ppp/chatscripts/sim800c'
|
|
||||||
58
script
58
script
|
|
@ -1,58 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# /etc/init.d/sim800c
|
|
||||||
|
|
||||||
INTERFACE_NAME=ppp0
|
|
||||||
# see https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-GPIO for details
|
|
||||||
PIN_NUMBER=34
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
if ip link show $INTERFACE_NAME > /dev/null 2>&1; then
|
|
||||||
echo "Interface $INTERFACE_NAME already exists"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "/sys/class/gpio/gpio{PIN_NUMBER}" ]; then
|
|
||||||
echo $PIN_NUMBER > /sys/class/gpio/export
|
|
||||||
fi
|
|
||||||
echo out > "/sys/class/gpio/gpio$PIN_NUMBER/direction"
|
|
||||||
echo 1 > "/sys/class/gpio/gpio$PIN_NUMBER/active_low"
|
|
||||||
echo 1 > "/sys/class/gpio/gpio$PIN_NUMBER/value"
|
|
||||||
pon sim800c
|
|
||||||
;;
|
|
||||||
|
|
||||||
stop)
|
|
||||||
poff sim800c
|
|
||||||
echo 0 > "/sys/class/gpio/gpio$PIN_NUMBER/value"
|
|
||||||
echo $PIN_NUMBER > /sys/class/gpio/unexport
|
|
||||||
;;
|
|
||||||
|
|
||||||
restart|reload)
|
|
||||||
$0 stop
|
|
||||||
sleep 10
|
|
||||||
$0 start
|
|
||||||
;;
|
|
||||||
|
|
||||||
healthcheck)
|
|
||||||
# DNS names also available
|
|
||||||
PUBLIC_ADDR=1.1.1.1
|
|
||||||
PACKET_COUNT=5
|
|
||||||
TIMEOUT=10
|
|
||||||
if ! ping -I $INTERFACE_NAME -c $PACKET_COUNT -W $TIMEOUT $PUBLIC_ADDR > /dev/null 2>&1; then
|
|
||||||
echo "Healthcheck failed"
|
|
||||||
systemctl restart sim800.service
|
|
||||||
# $0 restart
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Healthcheck passed"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Usage: $0 {start|stop|restart|healthcheck}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
16
service
16
service
|
|
@ -1,16 +0,0 @@
|
||||||
# /etc/systemd/system/sim800.service
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=SIM800C PPP Connection
|
|
||||||
After=rc-local.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
ExecStart=/etc/init.d/sim800c start
|
|
||||||
ExecStop=/etc/init.d/sim800c stop
|
|
||||||
# PIDFile=/run/ppp0.pid
|
|
||||||
# Restart=on-failure
|
|
||||||
# RestartSec=5s
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
Loading…
Reference in New Issue
Block a user