Initial Draft for termux-services
This commit is contained in:
parent
d9197aa09e
commit
7845adf3e2
@ -71,5 +71,6 @@ termux_step_post_make_install() {
|
||||
echo '#!/bin/sh' > telnetd/run
|
||||
echo 'exec busybox telnetd -F' >> telnetd/run
|
||||
chmod +x */run
|
||||
touch telnetd/down lftp/down
|
||||
}
|
||||
|
||||
|
10
packages/termux-services/build.sh
Normal file
10
packages/termux-services/build.sh
Normal file
@ -0,0 +1,10 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://termux.com/
|
||||
TERMUX_PKG_DESCRIPTION="Service daemon for Termux"
|
||||
TERMUX_PKG_VERSION=0.01
|
||||
TERMUX_PKG_PLATFORM_INDEPENDENT=yes
|
||||
|
||||
termux_step_make_install () {
|
||||
cp -p $TERMUX_PKG_BUILDER_DIR/termux-services $TERMUX_PREFIX/bin/
|
||||
mkdir -p $TERMUX_PREFIX/etc/profile.d/
|
||||
cp -p $TERMUX_PKG_BUILDER_DIR/start-services.sh $TERMUX_PREFIX/etc/profile.d/
|
||||
}
|
2
packages/termux-services/start-services.sh
Normal file
2
packages/termux-services/start-services.sh
Normal file
@ -0,0 +1,2 @@
|
||||
export SVDIR=$PREFIX/var/service
|
||||
(termux-services start >/dev/null 2>&1 & )
|
47
packages/termux-services/termux-services
Executable file
47
packages/termux-services/termux-services
Executable file
@ -0,0 +1,47 @@
|
||||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
|
||||
set -e
|
||||
start(){
|
||||
start-stop-daemon -q -S -b -m -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_OPTS
|
||||
}
|
||||
stop(){
|
||||
start-stop-daemon -K -s 1 -o -p "$PIDFILE" -q
|
||||
tail -f --pid=`cat "$PIDFILE"` /dev/null
|
||||
for f in "$SVDIR"/*/supervise "$SVDIR"/*/log/supervise;do
|
||||
if [ -e "$f" ];then
|
||||
kill -9 `cat "$f"/pid` 2>/dev/null ||:
|
||||
rm -rf "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
# Must be a valid filename
|
||||
NAME=termux-serivces
|
||||
PIDFILE="$PREFIX/var/run/$NAME.pid"
|
||||
#This is the command to be run, give the full pathname
|
||||
DAEMON="$PREFIX/bin/applets/runsvdir"
|
||||
DAEMON_OPTS="$SVDIR"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting daemon: $NAME"
|
||||
start
|
||||
echo "."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping daemon: $NAME"
|
||||
stop
|
||||
echo "."
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting daemon: $NAME"
|
||||
stop
|
||||
start
|
||||
echo "."
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: "$1" {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user