source: Slackware/i2p-base/rc.i2p_def @ 3998ce31

Last change on this file since 3998ce31 was 3998ce31, checked in by sponge <sponge@…>, 10 years ago

Fix rc.i2p for slackware package

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#!/bin/sh
2# Start/stop i2p service.
3
4i2p_start() {
5 # Check if router is up first!
6 /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory status )" > /dev/null
7 if [ ! $? -eq 0 ] ; then {
8  # I2p is already running, so tell the user.
9  echo "I2P is already running..."
10  i2p_status
11 } 
12 else
13 {
14  # Just in-case there are leftover junk in /tmp...
15  rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping
16  # Now that all junk is cleaned up, start.
17  /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory start )"
18 }
19 fi
20}
21
22i2p_stop() {
23 /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory stop )"
24 rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping
25}
26
27i2p_restart() {
28 # We want a FULL cycle here, not the wrappers idea of this!
29 i2p_stop
30 i2p_start
31}
32
33i2p_status() {
34 /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory status )"
35}
36
37i2p_console() {
38 /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory console )"
39}
40
41i2p_dump() {
42 /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory dump )"
43}
44
45case "$1" in
46'start')
47  i2p_start
48  ;;
49'stop')
50  i2p_stop
51  ;;
52'restart')
53  i2p_restart
54  ;;
55'status')
56  i2p_status
57  ;;
58'console')
59  i2p_console
60  ;;
61'dump')
62  i2p_dump
63  ;;
64*)
65  echo "usage $0 start|stop|restart|status|console|dump"
66  ;;
67esac
68
Note: See TracBrowser for help on using the repository browser.