I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit a0499451 authored by jrandom's avatar jrandom Committed by zzz
Browse files

let windows users install/remove the service through the /configservice.jsp page

parent bbdf1a0b
No related branches found
No related tags found
No related merge requests found
package net.i2p.router.web; package net.i2p.router.web;
import java.io.IOException;
import net.i2p.router.ClientTunnelSettings; import net.i2p.router.ClientTunnelSettings;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.apps.systray.SysTray; import net.i2p.apps.systray.SysTray;
import org.tanukisoftware.wrapper.WrapperManager; import org.tanukisoftware.wrapper.WrapperManager;
...@@ -39,6 +40,10 @@ public class ConfigServiceHandler extends FormHandler { ...@@ -39,6 +40,10 @@ public class ConfigServiceHandler extends FormHandler {
} else if ("Hard restart".equals(_action)) { } else if ("Hard restart".equals(_action)) {
_context.router().shutdown(Router.EXIT_HARD_RESTART); _context.router().shutdown(Router.EXIT_HARD_RESTART);
addFormNotice("Hard restart requested"); addFormNotice("Hard restart requested");
} else if ("Run I2P on startup".equals(_action)) {
installService();
} else if ("Don't run I2P on startup".equals(_action)) {
uninstallService();
} else if ("Dump threads".equals(_action)) { } else if ("Dump threads".equals(_action)) {
try { try {
WrapperManager.requestThreadDump(); WrapperManager.requestThreadDump();
...@@ -74,4 +79,21 @@ public class ConfigServiceHandler extends FormHandler { ...@@ -74,4 +79,21 @@ public class ConfigServiceHandler extends FormHandler {
addFormNotice("Blah blah blah. whatever. I'm not going to " + _action); addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
} }
} }
}
private void installService() {
try {
Runtime.getRuntime().exec("install_i2p_service_winnt.bat");
addFormNotice("Service installed");
} catch (IOException ioe) {
addFormError("Warning: unable to install the service - " + ioe.getMessage());
}
}
private void uninstallService() {
try {
Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat");
addFormNotice("Service removed");
} catch (IOException ioe) {
addFormError("Warning: unable to remove the service - " + ioe.getMessage());
}
}
}
\ No newline at end of file
...@@ -39,18 +39,15 @@ ...@@ -39,18 +39,15 @@
If you are on windows, you can either enable or disable that icon here. <br /> If you are on windows, you can either enable or disable that icon here. <br />
<input type="submit" name="action" value="Show systray icon" /> <input type="submit" name="action" value="Show systray icon" />
<input type="submit" name="action" value="Hide systray icon" /> <input type="submit" name="action" value="Hide systray icon" />
<!-- <% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %>
<h4>Run on startup</h4> <h4>Run on startup</h4>
On the windows platform, you can control whether I2P is run on startup or not by You can control whether I2P is run on startup or not by selecting one of the
selecting one of the following options - I2P will install (or remove) a service following options - I2P will install (or remove) a service accordingly. You can
accordingly. On *nix machines, you need root permissions to add a script also run the <code>install_i2p_service_winnt.bat</code> (or
to be run on startup (we hope you know better than to run I2P as root ;). To <code>uninstall_i2p_service_winnt.bat</code>) from the command line, if you prefer.<br />
have I2P run (or not run) at startup on *nix machines, please run
<code>install_i2p_service_unix</code> or <code>install_i2p_service_unix</code>
as root.<br />
<input type="submit" name="action" value="Run I2P on startup" /> <input type="submit" name="action" value="Run I2P on startup" />
<input type="submit" name="action" value="Don't run I2P on startup" /> <input type="submit" name="action" value="Don't run I2P on startup" />
--> <% } %>
<h4>Debugging</h4> <h4>Debugging</h4>
At times, it may be helpful to debug I2P by getting a thread dump. To do so, At times, it may be helpful to debug I2P by getting a thread dump. To do so,
please select the following option and review the thread dumped to please select the following option and review the thread dumped to
......
...@@ -21,10 +21,12 @@ linked together).</p> ...@@ -21,10 +21,12 @@ linked together).</p>
<p>With the I2P install we've bundled some scripts and code (from the cool folks at <p>With the I2P install we've bundled some scripts and code (from the cool folks at
<a href="http://wrapper.tanukisoftware.org/doc/english/">tanukisoftware</a>) to let you <a href="http://wrapper.tanukisoftware.org/doc/english/">tanukisoftware</a>) to let you
run I2P as a service on windows machines (a daemon, for you *nix geeks). To install it, run I2P as a service on windows machines (a daemon, for you *nix geeks). Windows users can
just run install_i2p_service_winnt.bat (or install_i2p_service_unix, as root). To uninstall add or remove the I2P service on the <a href="/configservice.jsp">service control page</a>, or
it, run uninstall_i2p_service_winnt.bat (or uninstall_i2p_service_unix, as root). To uninstall through the install_i2p_service_winnt.bat and uninstall_i2p_service_winnt.bat scripts. *nix
I2P altogether, simply wipe the I2P installation directory.</p> users can use the install_i2p_service_unix and uninstall_i2p_service_unix scripts included, but
they must be run as root. To uninstall I2P altogether, simply wipe the I2P installation
directory.</p>
<h2>What next?</h2> <h2>What next?</h2>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment