JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 19.03.2017, 01:04
nb0023
Guest
 
Posts: n/a
Default Raspberry Pi: JDownloader remote access not working

I have a rPi 1 model b running Raspbian Jessie lite (headless). I want to install JD2 headless so that I can remotely send downloads to it using my phone, but I cant get it to work. I followed this guide, including installing Oracle Java 8, but it doesnt show up in my jdownloader. Here are the steps in order

Code:
sudo apt-get install oracle-java8-jdk
mkdir jdownloader
cd jdownloader
wget http://installer.jdownloader.org/JDownloader.jar
java -Djava.awt.headless=true -jar JDownloader.jar
This next step is where I encountered a problem because this file was empty, I was expecting a file where I would just fill in my details

Code:
sudo nano /home/pi/jdownloader/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json
I googled and found this and I filled in my password and email and saved the file

Code:
{ "password" : "mypassword", "email" : "email@home.org" }
I used **External links are only visible to Support Staff**this init file instead of the one in the tutorial because its in german.. I compared the two files and made some changes to DIR, and the JAVA path and I took out the USER = JD line

Code:
 
#!  / Bin / sh 
  # ## BEGIN INIT INFO 
  # Provides: JDownloader2 
  # Required-Start: networking 
  # Required-Stop: 
  # Default start: 2 3 4 5 
  # Default Stop: 0 1 6 
  # Short-Description: JDownloader2 server daemon 
  # Description: JDownloader2 server daemon 
  # ## END INIT INFO 

  DIR=”/home/pi/jdownloader”
  PIDFILE = " $ DIR /JDownloader.pid " 
   JAVA=”/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java”
  PARAM = " -Djava.awt.headless = true -jar $ DIR /JDownloader.jar " 

  Start_daemon () { 
  Start-stop-daemon --start --background --oknodo --chuid $ USER --make-pidfile --pidfile $ PIDFILE --exec $ JAVA - $ PARAM 
  } 
  Stop_daemon () { 
  Start-stop-daemon --stop --pidfile $ PIDFILE 
  } 
  # Switch case 
  Case " $ 1 " in 
  begin) 
  # On start 
  Echo " Start JDownloader " 
  Start_daemon 
  ;; 
  Stop) 
  # On stop 
  Echo " Stop JDownloader " 
  Stop_daemon 
  ;; 
  Restart) 
  # On restart 
  Echo " Restart JDownloader " 
  Start_daemon 
  Stop_daemon 
  ;; 
  * ) 
  # Default action 
  Echo " (start | stop | restart) " 
  ;; 
  Esac 
 Exit 0
and than I run these commands but it doesnt work (I'm unsure if I have correctly installed the init script)

Code:
pi@raspberrypi:~ $  sudo chmod +x /etc/init.d/jdownloader
pi@raspberrypi:~ $  sudo systemctl daemon-reload
pi@raspberrypi:/ $ sudo systemctl enable jdownloader
Synchronizing state for jdownloader.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d jdownloader defaults
Executing /usr/sbin/update-rc.d jdownloader enable
but nothing....

Edit: Seems like the jdownloader service is running

Code:
pi@raspberrypi:/ $ systemctl is-active jdownloader.service
active
Edit again: It seems the process is running

Code:
pi@raspberrypi:/ $ ps aux | grep jdownloader
pi       13362  0.0  0.3   4268  1652 pts/0    S+   16:10   0:00 grep --color=auto jdownloader
Edit: Turns out my java path was wrong. Its its the jdk-8-oracle-arm32-vfp-hflt folder not in jdk-8-oracle-arm-vfp-hflt but it still doesnt work

Last edited by nb0023; 19.03.2017 at 03:33.
Reply With Quote
  #2  
Old 19.03.2017, 03:14
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

the DIR and JAVA variable has the incorrect quotation marks?
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3  
Old 19.03.2017, 03:27
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by raztoki View Post
the DIR and JAVA variable has the incorrect quotation marks?
I just checked and they are fine in the file but I replaced them anyways and still no luck :(
Reply With Quote
  #4  
Old 19.03.2017, 03:39
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

are you able to start via cli outside of script ?
"/pathtojava" -Djava.awt.headless=true -jar "/pathtojd/JDownloader.jar"
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #5  
Old 19.03.2017, 05:23
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by raztoki View Post
are you able to start via cli outside of script ?
"/pathtojava" -Djava.awt.headless=true -jar "/pathtojd/JDownloader.jar"
It updated and restarted
Code:
|---------------------------Headless Information-------------------------------
|	Restart Required
|	JDownloader Updated and restarted itself.
|	The process restarted itself and runs now in the background: 1964@raspberrypi
|	If you do not want JD to restart itself, use the -norestart switch.
|------------------------------------------------------------------------------
I ran the command again I pasted it **External links are only visible to Support Staff**here because its long
Reply With Quote
  #6  
Old 19.03.2017, 05:33
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

clearly shows in the log you already have instance running in the background.

Code:
[ org.jdownloader.update.launcher.SecondLevelLauncher(init) ] -> existing jD instance found!
1|org.jdownloader.update.launcher.SecondLevelLauncher.log 3/18/17 8:21:42 PM - INFO [ org.jdownloader.update.launcher.SecondLevelLauncher(init) ] -> Send parameters to existing jD instance and exit: [--focus]
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #7  
Old 19.03.2017, 05:40
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by raztoki View Post
clearly shows in the log you already have instance running in the background.

Code:
[ org.jdownloader.update.launcher.SecondLevelLauncher(init) ] -> existing jD instance found!
1|org.jdownloader.update.launcher.SecondLevelLauncher.log 3/18/17 8:21:42 PM - INFO [ org.jdownloader.update.launcher.SecondLevelLauncher(init) ] -> Send parameters to existing jD instance and exit: [--focus]
Edit: Okay it works now but only after I manually start it with "/pathtojava" -Djava.awt.headless=true -jar "/pathtojd/JDownloader.jar". I tried rebooting several times and it doesnt work unless I manually start it

Last edited by nb0023; 19.03.2017 at 05:56.
Reply With Quote
  #8  
Old 20.03.2017, 00:58
nb0023
Guest
 
Posts: n/a
Default

Can anybody help? I changed my init file to this one but it still doesnt work. I can start it manually by entering the following command line argument but it will not start automatically after reboot

Code:
sudo "/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java" -Djava.awt.headless=true -jar JDownloader.jar
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: jDownloader2
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: jDownloader2 Server Daemon
# Description: jDownloader2 Server Daemon
### END INIT INFO

DIR="/home/pi/jdownloader"
PIDFILE="$DIR/JDownloader.pid"
JAVA="/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java"
PARAM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar"

start_daemon () {
start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile $PIDFILE –exec $JAVA — $PARAM
}

stop_daemon () {
start-stop-daemon –stop –pidfile $PIDFILE
}

#Switch case fuer den ersten Parameter
case "$1" in
start)
#Aktion wenn start uebergeben wird
echo "Starte jDownloader2"
start_daemon
;;

stop)
#Aktion wenn stop uebergeben wird
echo "Stoppe jDownloader2"
stop_daemon
;;

restart)
#Aktion wenn restart uebergeben wird
echo "Restarte jDownloader2"
start_daemon
stop_daemon
;;
*)
#Standard Aktion wenn start|stop|restart nicht passen
echo "(start|stop|restart)"
;;
esac

exit 0
Reply With Quote
  #9  
Old 20.03.2017, 01:24
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

remove the ' - ' between java and param?
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #10  
Old 20.03.2017, 01:40
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by raztoki View Post
remove the ' - ' between java and param?
Do you mean in this line?

Code:
  Start-stop-daemon --start --background --oknodo --chuid $ USER --make-pidfile --pidfile $ PIDFILE --exec $ JAVA - $ PARAM
So it should be

Code:
  Start-stop-daemon --start --background --oknodo --chuid $ USER --make-pidfile --pidfile $ PIDFILE --exec $ JAVA $ PARAM
Reply With Quote
  #11  
Old 20.03.2017, 01:41
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

yes, try it ;p
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #12  
Old 20.03.2017, 04:33
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by raztoki View Post
yes, try it ;p
Its still not working :(
Reply With Quote
  #13  
Old 20.03.2017, 15:14
barkle barkle is offline
DSL Light User
 
Join Date: Sep 2016
Posts: 34
Default

Quote:
Originally Posted by nb0023 View Post
Its still not working :(
OK.

First: no Space " " between "$" and parameter
Wrong: $ DIR
Correct $DIR
Please correct it in all your files

Second: no space in the first line and all is lowerletter
Code:
#!/bin/bash

Lets do some debugging:

Edit your file "/etc/init.d/jdownloader".
Your startline is:

Code:
start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile $PIDFILE –exec $JAVA $PARAM
Make sure it look like the above. Copy both (yours from the file and this one from the forum) to your editor and compare letter for letter!

When its correct, go to terminal-window/commandline an write
HTML Code:
sudo /etc/init.d/jdownloader start
Working? Yes-> fine, done


No put an "echo" in front of that line, so it looks like:

Code:
echo start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile $PIDFILE –exec $JAVA $PARAM

go to terminal-window/commandline an write
HTML Code:
sudo /etc/init.d/jdownloader start
looks your line like that?
Code:
start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile /home/pi/jdownloader/JDownloader.pid –exec /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java -Djava.awt.headless=true -jar /home/pi/jdownloader/JDownloader.jar
Yes: can you test that line in the teminal-window?
No: You use something other, please post the actuell file "/etc/init.d/jdownloader" again
Reply With Quote
  #14  
Old 20.03.2017, 18:20
barkle barkle is offline
DSL Light User
 
Join Date: Sep 2016
Posts: 34
Default

Quote:
Originally Posted by nb0023 View Post
Its still not working :(
I've forgotten the links.

Is there a link from /etc/init.d/jdownloader to the "startup"-directories?

in /etc there are eight "rcx.d"-directories

For startup on boot you need in Raspbian a link from your file to /etc/rc2.d:

Code:
sudo ln -s /etc/init.d/jdownloader /etc/rc2.d/S99jdownloader

And stopping jdownloader you need a link in rc6.d and rc0.d (I dont know exactly which one)

Code:
sudo ln -s /etc/init.d/jdownloader /etc/rc0.d/K00jdownloader
sudo ln -s /etc/init.d/jdownloader /etc/rc6.d/K00jdownloader

The number after the "S" or "K" defines the sequence. I think it's good to start jdownloader when all other are startet. For that I use the "99". And the same reason for shutdown. Jdwonloader will be the first to stop.
Reply With Quote
  #15  
Old 20.03.2017, 19:27
nb0023
Guest
 
Posts: n/a
Default

Okay so I went through the file and made the syntax changes you said to make and I also noticed many other things and changed them (like changing Echo to echo and making all the function names in lower case Start_daemon to start_daemon etc)

Here is the updated file

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides: jDownloader2
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: jDownloader2 Server Daemon
# Description: jDownloader2 Server Daemon
### END INIT INFO

DIR="/home/pi/jdownloader"
PIDFILE="$DIR/JDownloader.pid"
JAVA="/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java"
PARAM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar"

  start_daemon () {
  echo start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile $PIDFILE –exec $JAVA $PARAM
  }
  stop_daemon () {
  start-stop-daemon --stop --pidfile $PIDFILE
  }
  # Switch case
  case "$1" in
  start)
  # On start
  echo "Start JDownloader"
  start_daemon
  ;;
  stop)
  # On stop
  echo "Stop JDownloader"
  stop_daemon
  ;;
  restart)
  # On restart
  echo "Restart JDownloader"
  start_daemon
  stop_daemon
  ;;
  * )
  # Default action
  echo "(start | stop | restart)"
  ;;
  esac
 exit 0
Quote:
Originally Posted by barkle View Post

HTML Code:
sudo /etc/init.d/jdownloader start
Working? Yes-> fine, done
Nope, not working. Here is the output

Code:
Start JDownloader
start-stop-daemon: invalid option -- 'D'
Try 'start-stop-daemon --help' for more information.
Quote:
Originally Posted by barkle View Post
No put an "echo" in front of that line, so it looks like:

Code:
echo start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile $PIDFILE –exec $JAVA $PARAM

go to terminal-window/commandline an write
HTML Code:
sudo /etc/init.d/jdownloader start
looks your line like that?
Code:
start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile /home/pi/jdownloader/JDownloader.pid –exec /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java -Djava.awt.headless=true -jar /home/pi/jdownloader/JDownloader.jar
Yes it seems to be the same output

Code:
Start JDownloader
start-stop-daemon –start –background –oknodo –chuid pi –group pi –make-pidfile –pidfile /home/pi/jdownloader/JDownloader.pid –exec /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java -Djava.awt.headless=true -jar /home/pi/jdownloader/JDownloader.jar
Reply With Quote
  #16  
Old 20.03.2017, 20:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Your script contains errors again!
Quote:
#!/bin/sh
### BEGIN INIT INFO
# Provides: JDownloader2
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: JDownloader2 server daemon
# Description: JDownloader2 server daemon
### END INIT INFO

DIR="/home/jd/jdownloader"
PIDFILE="$DIR/JDownloader.pid"
JAVA="/usr/bin/java"
PARAM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar"
USER="jd"

start_daemon () {
start-stop-daemon --start --background --oknodo --chuid $USER --make-pidfile --pidfile $PIDFILE --exec $JAVA -- $PARAM
}

stop_daemon () {
start-stop-daemon --stop --pidfile $PIDFILE
}

# Switch case
case "$1" in
start)
# On start
echo "Start JDownloader"
start_daemon
;;

stop)
# On stop
echo "Stop JDownloader"
stop_daemon
;;

restart)
# On restart
echo "Restart JDownloader"
start_daemon
stop_daemon
;;
*)
# Default action
echo "(start|stop|restart)"
;;
esac

exit 0
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 20.03.2017 at 20:07.
Reply With Quote
  #17  
Old 20.03.2017, 20:05
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Please set correct DIR=, USER= and JAVA= values
__________________
JD-Dev & Server-Admin
Reply With Quote
  #18  
Old 20.03.2017, 22:13
nb0023
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
Your script contains errors again!

IT WORKS!!!! Thank you!
Reply With Quote
  #19  
Old 21.03.2017, 10:48
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

You're welcome In case you've got further questions, don't hesitate to ask here or contact us via support@jdownloader.org
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 16:57.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.