summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2019-05-11 20:28:57 +0200
committerBjørn Mork <bjorn@mork.no>2019-05-11 20:28:57 +0200
commit0922d41d55d509b71e8e73505ed265f49f531863 (patch)
tree64dec55239532d767216007b22acd8c504fb05ae
parentc0fbd6dc6bbbad38b97595f2469eb7fabd250760 (diff)
add a telnetd and lighttpd startup script
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rwxr-xr-xopt.local66
1 files changed, 66 insertions, 0 deletions
diff --git a/opt.local b/opt.local
new file mode 100755
index 0000000..a459192
--- /dev/null
+++ b/opt.local
@@ -0,0 +1,66 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Copyright(c) 2019 Bjørn Mork <bjorn@mork.no>
+
+PATH=$PATH:/opt
+export LD_LIBRARY_PATH=/opt:$LD_LIBRARY_PATH
+
+die() {
+ echo $@
+ exit 1
+}
+
+showUsage() {
+ die "$0 {start|stop|restart|status}"
+}
+
+action=$1
+
+start() {
+ echo "opt.local start"
+
+ echo "Make sure there is an admin account with the pincode as password"
+ grep -Eq ^admin: /etc/passwd || echo admin:x:0:0::/:/bin/sh >>/etc/passwd
+ grep -Eq ^admin:x: /etc/passwd && echo "admin:$(pibinfo Pincode)" | chpasswd
+
+ echo "Starting telnetd"
+ pidof telnetd || telnetd
+
+ tdb set HTTPAccount AdminPasswd_ss="$(pibinfo Pincode)"
+ /etc/rc.d/init.d/extra_lighttpd.sh start
+
+ echo "opt.local start ok."
+}
+
+stop() {
+ /etc/rc.d/init.d/extra_lighttpd.sh stop
+
+ echo "opt.local stop ok."
+}
+
+status() {
+ /etc/rc.d/init.d/extra_lighttpd.sh status
+}
+
+
+case $action in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ sleep 1
+ start
+ ;;
+ status)
+ status
+ ;;
+ *)
+ showUsage
+ ;;
+esac
+
+exit 0