Permalink
Browse files

added daemon-only support for WDLXTV webend

  • Loading branch information...
1 parent 1b6dcf0 commit 64ac0fe2135ea01e2bae5250f5977df77d79724a @jaromil jaromil committed Dec 30, 2011
Showing with 94 additions and 2 deletions.
  1. +6 −2 scripts/S99tor
  2. +3 −0 scripts/assemble-app-bin.sh
  3. +56 −0 scripts/daemon
  4. +29 −0 webend/webend.conf
View
@@ -4,7 +4,7 @@
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -62,7 +62,7 @@ if ! [ -r ${USBROOT}tor/privoxy.conf ]; then
else
log "Privoxy configiration file found in ${USBROOT}tor/privoxy.conf"
fi
-
+
log "Preparing to launch Tor daemon"
cp ${USBROOT}/tor/tor.conf /tmp
echo "Log notice file /tmp/tor-daemon.log" >> /tmp/tor.conf
@@ -77,3 +77,7 @@ tor -f /tmp/tor.conf
log "Launching Privoxy in background"
privoxy ${USBROOT}tor/privoxy.conf
log "Done."
+
+echo "running" > /tmp/tor.state
+
+add.webplugin tor $APPROOT/webend
@@ -46,10 +46,13 @@ if [ -z $1 ]; then
cp -rav etc/privoxy $appdir/etc &&
cp -v etc/geoip $appdir/etc &&
cp -v scripts/S99tor $appdir/etc/init.d &&
+ cp -v scripts/daemon $appdir/etc/init.d &&
cp -v scripts/torctl $appdir/bin &&
cp -v scripts/tor-ctrl.sh $appdir/bin &&
cp -v scripts/torify $appdir/bin &&
chmod a+x $appdir/etc/init.d/S99tor &&
+ chmod a+x $appdir/etc/init.d/daemon &&
+ cp -rav webend $appdir &&
cp -v README $appdir
sudo chown -R root:root $appdir
View
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+log() { echo "[`date +%T`] $@" >> /tmp/tor.log; }
+
+if [ "$1" == "start" ]; then
+
+ log "Daemon start called"
+
+ state=`cat /tmp/tor.state`
+ if [ "$state" == "running" ]; then
+
+ log "Tor already running, command ignored."
+ echo "Tor is already running, command ignored."
+
+ else
+
+ log "Launching Tor in background"
+ tor -f /tmp/tor.conf
+
+ log "Launching Privoxy in background"
+ privoxy ${USBROOT}tor/privoxy.conf
+
+ log "Daemon start completed."
+ rm -f /tmp/tor.state
+ echo "running" > /tmp/tor.state
+ fi
+
+elif [ "$1" == "stop" ]; then
+
+ log "Daemon stop called"
+
+ state=`cat /tmp/tor.state`
+ if [ "$state" == "stopped" ]; then
+
+ log "Tor already stopped, command ignored."
+ echo "Tor is already stopped, command ignored."
+
+ else
+
+ log "Killing Tor"
+ killall tor
+
+ log "Killing Privoxy"
+ killall privoxy
+
+ log "Daemon stop completed."
+ rm -f /tmp/tor.state
+ echo "stopped" > /tmp/tor.state
+ fi
+
+else
+ echo "usage: daemon [ start | stop ]"
+ echo "Starts or stops tor+prixovy (TorTV app)"
+ log "Daemon command unknown: $1"
+ log "Daemon state: `cat /tmp/tor.state`"
+fi
View
@@ -0,0 +1,29 @@
+#### parameters for starter-icon for Web Frontend (not necessary for
+#### daemon-only apps) all php and image files are relative to the
+#### directory that webend.conf is in
+
+# Reference to start page (e.g. index.php)
+#TARGET=index.php
+# Reference to the image file for the Web Frontend icon
+#IMAGE=ddclient-gui.png
+# Size of the popup window for your application in Web Frontend
+#WINDOW_SIZE_HEIGHT=700
+#WINDOW_SIZE_WIDTH=900
+# Whether the icon should disappear when plugin isn't found
+#FLAG_EXISTS=YES
+
+# Reference to config page (e.g. config.php) - comment out if no
+# configuration is necessary
+# CONFIG_SIDE=config.php
+
+# Whether the icon should disappear if the daemon not running
+# NOTE: If this is set, you must also set DAEMON_NAME below
+#ICON_DISAPPEAR_DAEMON_OFF=YES
+
+#### parameter for daemon status and management (not needed for
+#### web-only apps)
+# daemon name - must exactly match the name of your daemon process (case-sensitive)
+DAEMON_NAME=tor
+# commands to start and stop your daemon - these must be Unix commands
+DAEMON_START_COMMAND="/apps/tor/etc/init.d/daemon start"
+DAEMON_STOP_COMMAND="/apps/tor/etc/init.d/daemon stop"

0 comments on commit 64ac0fe

Please sign in to comment.