Quote:
Originally Posted by juno99
Can you tell me what command will stop it?
Can't find it...
|
Quote:
Originally Posted by mehmeh
now, I'm using JD2 headless into my raspberryPi and it works fine.
I have started JD2 using this command:
Code:
java -Djava.awt.headless=true -jar JDownloader.jar &
and after some minutes I have closed the ssh connection, and JD2 has continued to run.
I use JD2 using the myJdownloader website.
But I have a problem, how can I stop JD2 without corrupt the JD2 files and download?
thanks
|
Quote:
Originally Posted by sjaddy
[...]
If i run a SSH terminal and from the jdownloader directory run
java -Djava.awt.headless=true -jar JDownloader.jar &
it works and I can connect from my.jdownloader.org
when I close the ssh session though it closes the connection to my.jdownloader.org
Is anyone able to give me any pointers as to where I should look for the issue or logs I can check or what I have done wrong?
TIA
|
I use JD unix server headless instance, accessing via WEB INTERFACE @ my.jdownloader.org
To make it easy to manage I wrote "Start Stop Restart Status" SCRIPT
Here is HOW-TO for newbies:
1. Create file
jdownloader with text editor of your choice at
/etc/init.d/ i.e.:
Code:
sudo vim /etc/init.d/jdownloader
2. Paste this content and replace
red-bold text with your variables:
Code:
#! /bin/sh
# /etc/init.d/jdownloader
### 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: T_Send's Starts/Stops/Restarts/Status the jDownloader2 Server Daemon
### END INIT INFO
# Author: T_Send Contact: t_send@itnu.pl Web: www.itnu.pl
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="jDownloader2 Server"
NAME="jdownloader"
## USER for new files ownership & make sure USER has read/write permission to DOWNLOAD-DIR
USER=<User_Name_or_UID_to_run_as>
GROUP=<Group_Name_or_GID_to_run_as>
UMASK=<Change_umask_to_UMASK_before_starting>
DIR="<path_to_JD_folder>"
SCRIPT="/etc/init.d/$NAME"
PIDFILE="$DIR/JDownloader.pid"
JAVA="<complete_path_to_java_exec>"
PARM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar"
STATUS="$JAVA $PARM"
. /lib/lsb/init-functions
start_daemon () {
start-stop-daemon --start \
--chuid $USER \
--group $GROUP \
--umask $UMASK \
--oknodo \
--background \
--make-pidfile --pidfile $PIDFILE \
--exec $JAVA -- $PARM
log_end_msg $?
}
case "$1" in
start)
log_daemon_msg "Starting daemon" "$DESC "
start_daemon
;;
stop)
log_daemon_msg "Stopping daemon" "$DESC "
start-stop-daemon --stop \
--pidfile $PIDFILE
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting daemon" "$DESC "
start-stop-daemon --stop
log_end_msg $?
start_daemon
;;
status)
status_of_proc "$STATUS" "$DESC " && exit 0 || exit $?
;;
*)
log_action_msg "Usage: $SCRIPT {start|stop|restart|status}" || true
exit 2
;;
esac
exit 0
Ad.2. To find
<complete_path_to_java_exec> follow by sym-links i.e.
Code:
ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 paź 25 08:18 /usr/bin/java -> /etc/alternatives/java
ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 paź 25 08:18 /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
3. Save file, exit and run:
sudo chmod 755 /etc/init.d/jdownloader
4. You're DONE. Now you can use:
/etc/init.d/jdownloader start | stop | restart | status
or
service jdownloader start | stop | restart | status
For init systemd system (i.e. new Debian Jessie) read 5.b.
5.a. (optional for sysvinit based systems i.e. Debian 7 Wheezy / Ubuntu):
If you want to automatically start JD at system bootup, run:
sudo update-rc.d jdownloader defaults (for sysvinit systems)
5.b. (optional for systemd based system i.e. new Debian 8 Jessie):
run:
systemctl daemon-reload - to reload scripts from /etc/init.d dir (otherwise next command won't work)
systemctl enable jdownloader - to enable service autostart at boot
systemctl disable jdownloader - to remove service autostart at boot
systemctl status jdownloader - to show service status info
systemctl start | stop jdownloader - to start or stop service
Jessie is sysvinit backwards.
For additional SCRIPT parameters read
Code:
start-stop-daemon --help
or
man start-stop-daemon
and edit start_daemon () entry
Hope it helps someone.
Regards,
T_Send
Changelog:
- Added info for systemd systems (i.e. new Debian 8 Jessie)
- Added change umask before start option
- Added Run As Group option
- Changed PID location to JD HOME_DIR as it creates one on start, so it supports CLI commands after "Update & Restart" in WebInterface or other remote API.