rootfs added and auth service in

This commit is contained in:
wt committed 2024-07-03 14:16:25 +07:00
1 parent 35bd73b894
commit 1bea37deb2
113 files changed
+1369 -24

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting dnsd "
# sleep 10
/usr/bin/dnsd -d -c /etc/dnsd.conf
echo "nameserver 0.0.0.0" > /etc/resolv.conf
if [[ "$?" == "0" ]]; then
echo "nameserver 0.0.0.0" > /etc/resolv.conf
echo $(pgrep dnsd) > /var/run/dnsd.pid
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping dnsd "
kill $(cat /var/run/dnsd.pid) &> /dev/null
rm /var/run/dnsd.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "dnsmasq init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting dnsmasq "
sleep 1
/usr/bin/dnsmasq --user=dnsmasq --pid-file=/var/run/dnsmasq.pid
if [[ "$?" == "0" ]]; then
echo "nameserver 0.0.0.0" > /etc/resolv.conf
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "\nStopping dnsmasq "
if [ -f /var/run/dnsmasq.pid ]; then
kill $(cat /var/run/dnsmasq.pid) &> /dev/null
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
rm /var/run/dnsmasq &> /dev/null
else
printf "[$Red Dnsmasq is not running $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "dnsmasq init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting fptd "
tcpsvd -vE 0.0.0.0 21 ftpd -w -S -A $(cat /etc/openrouter/ftppath) &>/dev/null &
echo $! > /var/run/ftpd.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Cpolor_Off]\n"
fi
;;
stop)
printf "Stopping ftpd "
kill $(cat /var/run/ftpd.pid)
killall ftpd
rm /var/run/ftpd.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "ftpd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Setting up hostname "
/bin/hostname -F /etc/hostname
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
stop)
;;
*)
echo "Hostname init script usage: $0 {start}"
return 1
esac
return $?
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting httpd "
httpd -h /srv/www &> /dev/null
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Cpolor_Off]\n"
fi
;;
stop)
printf "Stopping httpd "
killall httpd
#kill $(cat /var/run/httpd.pid)
#rm /var/run/httpd.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "httpd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
init () {
test -f $DAEMON || exit 0
case "$1" in
start)
echo "Starting $DESC..."
if [ $LOG ] ; then
$DAEMON $PARAMS 2>>/var/log/$LOG &
else
$DAEMON $PARAMS &>/dev/null &
fi
echo $! > $PIDFILE
;;
stop)
printf "\nStopping $DESC..."
if [ $STOP ] ; then
$STOP $PARAMS
else
[ -f $PIDFILE ] && kill $(cat $PIDFILE) &>/dev/null
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "$NAME init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
}
rc () {
if [ -d /etc/rc.d ] && [ $0 == "/etc/init.d/rcK" ]; then
for x in $(ls -r /etc/rc.d/) ; do
/etc/rc.d/$x stop
done
return 1
fi
for i in /etc/rc.d/??* ; do
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
$i start
;;
esac
done
sleep 1
#clear
return 1
}
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
DAEMON="iptables"
IPTABLES_ARGS=""
start() {
printf 'Starting %s: ' "$DAEMON"
iptables-restore /etc/iptables.conf
status=$?
if [ "$status" -eq 0 ]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
iptables -F
status=$?
if [ "$status" -eq 0 ]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
save() {
printf 'Saving %s: ' "$DAEMON"
iptables-save -f /etc/iptables.conf
status=$?
if [ "$status" -eq 0 ]; then
printf "[$Green OK $Color_off]\n"
else
echo "SKIP (read-only file system detected)"
fi
return "$status"
}
case "$1" in
start|stop|restart|save)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|save|reload}"
exit 1
esac
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting klogd "
klogd
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping klogd "
if [ -f /var/run/klogd.pid ]; then
kill $(cat /var/run/klogd.pid)
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
rm /var/run/klogd.pid &> /dev/null
else
printf "[$Red Klogd is not running $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "klogd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting networking "
/usr/bin/ifup -a &>/dev/null &
echo $! > /var/run/networking.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Cpolor_Off]\n"
fi
;;
stop)
printf "Stopping networking "
/usr/bin/ifdown -a
rm /var/run/networking.pid
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "networking init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting openrouter software "
cd /srv/ftpd/auth_service_router/bin && ./auth_service &> /dev/null &
cd /srv/ftpd/openrouter_adminpanel/bin && ./openrouter &> /dev/null &
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Cpolor_Off]\n"
fi
;;
stop)
printf "Stopping openrouter software "
killall openrouter
killall auth_service
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "httpd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
. /etc/init.d/init-functions
rc
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
. /etc/init.d/init-functions
rc
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting sshd "
/usr/bin/sshd -D &
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping sshd "
killall sshd
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "sshd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Configuring swap "
swapon -a
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping use swap "
swapoff -a
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "swap init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
Green='\033[0;32m'
Color_Off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Setting up sysctl "
sysctl -p &> /dev/null
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_Off]\n"
else
printf "[$Red ERR $Color_Off]\n"
fi
;;
stop)
;;
*)
echo "Sysctl init script usage: $0 {start}"
return 1
esac
return $?
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting syslogd "
syslogd
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping syslogd "
if [ -f /var/run/syslogd.pid ]; then
kill $(cat /var/run/syslogd.pid)
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
rm /var/run/syslogd.pid &> /dev/null
else
printf "[$Red Syslogd is not running $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "syslogd init script usage: $0 {start|stop|restart}"
return 1
esac
return $?
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
case "$1" in
start)
printf "Starting telnet "
telnetd -p $(cat /etc/openrouter/telnet/port)
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
stop)
printf "Stopping telnet "
killall telnetd
if [[ "$?" == "0" ]]; then
printf "[$Green OK $Color_off]\n"
else
printf "[$Red ERR $Color_off]\n"
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "telnet init script usage: $0 {start|stop|restart}"
return 1
esac
return $?