Line 4: |
Line 4: |
| | | |
| {{Warning box|Only tested on SME Server 9.0}} | | {{Warning box|Only tested on SME Server 9.0}} |
− |
| |
− | ===Howto===
| |
| | | |
| JDownloader is since many years my favorite download manager. He has indeed many positive points: | | JDownloader is since many years my favorite download manager. He has indeed many positive points: |
Line 16: |
Line 14: |
| | | |
| Only an account is needed from my.jdownloader.org to use Jdownloader2 | | Only an account is needed from my.jdownloader.org to use Jdownloader2 |
| + | |
| + | ===Howto=== |
| + | |
| ====prepare and download==== | | ====prepare and download==== |
| * You need first to install java | | * You need first to install java |
Line 30: |
Line 31: |
| here you need an account with your password from http://my.jdownloader.org/ | | here you need an account with your password from http://my.jdownloader.org/ |
| * now you can launch the java software | | * now you can launch the java software |
− | java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar | + | java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar -norestart |
| | | |
| JD2 will ask to update, answer yes (y), then it need to restart | | JD2 will ask to update, answer yes (y), then it need to restart |
| | | |
| * launch again the java software | | * launch again the java software |
− | java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar | + | java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar |
| here it will ask your jdownloader account. | | here it will ask your jdownloader account. |
| {{Note box| at my first start, the former instance was not closed properly , I found these warnings when I launched JD2 the second time | | {{Note box| at my first start, the former instance was not closed properly , I found these warnings when I launched JD2 the second time |
Line 47: |
Line 48: |
| ====start at boot time==== | | ====start at boot time==== |
| now when you launch the command above your JD instance is able to run. we have to create an init script to run JD at the boot time | | now when you launch the command above your JD instance is able to run. we have to create an init script to run JD at the boot time |
| + | |
| * create the jdownloader system user | | * create the jdownloader system user |
− | /sbin/e-smith/create-system-user jdownloader 810 "Jdownloader server" /usr/share/JD2/ /bin/false | + | /sbin/e-smith/create-system-user jdownloader 810 "Jdownloader server" /var/lib/jdownloader /bin/bash |
| + | |
| + | * set good ownership |
| + | chown jdownloader:jdownloader /usr/share/JD2/ -R |
| + | |
| * create the db entry | | * create the db entry |
| db configuration set jdownloader service status enabled | | db configuration set jdownloader service status enabled |
| + | |
| * create the initscript | | * create the initscript |
| vim /etc/rc.d/init.d/jdownloader | | vim /etc/rc.d/init.d/jdownloader |
− | and past this | + | and paste this |
| #!/bin/sh | | #!/bin/sh |
| ### BEGIN INIT INFO | | ### BEGIN INIT INFO |
Line 66: |
Line 73: |
| SCRIPT='java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar' | | SCRIPT='java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar' |
| RUNAS='jdownloader' | | RUNAS='jdownloader' |
− | NAME='JD2' | + | NAME='jdownloader' |
| | | |
| PIDFILE=/var/run/$NAME.pid | | PIDFILE=/var/run/$NAME.pid |
− | LOGFILE=/var/log/$NAME.log | + | LOGFILE=/dev/null |
| | | |
| start() { | | start() { |
Line 80: |
Line 87: |
| su -s /bin/sh $RUNAS -c "$CMD" > "$PIDFILE" | | su -s /bin/sh $RUNAS -c "$CMD" > "$PIDFILE" |
| | | |
− | # Try with this command line instead of above if not workable
| + | sleep 5 |
− | # su -c "$CMD" $RUNAS > "$PIDFILE"
| |
− |
| |
− | sleep 2 | |
| PID=$(cat $PIDFILE) | | PID=$(cat $PIDFILE) |
− | if pgrep -u $RUNAS -f $NAME > /dev/null | + | if pgrep -u $RUNAS -f "$SCRIPT" > /dev/null |
| then | | then |
| echo "$NAME is now running, the PID is $PID" | | echo "$NAME is now running, the PID is $PID" |
Line 102: |
Line 106: |
| kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" | | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" |
| echo 'Service stopped' >&2 | | echo 'Service stopped' >&2 |
− | }
| |
− |
| |
− | uninstall() {
| |
− | echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
| |
− | local SURE
| |
− | read SURE
| |
− | if [ "$SURE" = "yes" ]; then
| |
− | stop
| |
− | rm -f "$PIDFILE"
| |
− | echo "Notice: log file is not be removed: '$LOGFILE'" >&2
| |
− | update-rc.d -f <NAME> remove
| |
− | rm -fv "$0"
| |
− | fi
| |
| } | | } |
| | | |
Line 141: |
Line 132: |
| status) | | status) |
| status | | status |
− | ;;
| |
− | uninstall)
| |
− | uninstall
| |
| ;; | | ;; |
| restart) | | restart) |
Line 150: |
Line 138: |
| ;; | | ;; |
| *) | | *) |
− | echo "Usage: $0 {start|stop|status|restart|uninstall}" | + | echo "Usage: $0 {start|stop|status|restart}" |
| esac | | esac |
| | | |
| we need to get that script executable | | we need to get that script executable |
− | chown u+x /etc/rc.d/init.d/jdownloader | + | chmod u+x /etc/rc.d/init.d/jdownloader |
| | | |
| and set the time when we want it starts | | and set the time when we want it starts |
| chkconfig --add jdownloader | | chkconfig --add jdownloader |
− | ln -s /etc/rc.d/init.d/e-smith-service S90jdownloader | + | ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S90jdownloader |
| + | signal-event remoteaccess-update |
| + | |
| + | ====Retrieve the downloads==== |
| + | we need to make a samba fragment |
| + | vim /etc/e-smith/templates/etc/smb.conf/91jdownloader |
| + | |
| + | { my $status = $jdownloader{'status'} || "disabled"; |
| + | return " # jdownloader is disabled in smb.conf" |
| + | unless $status eq 'enabled'; |
| + | { |
| + | my @jdownloader_smb_users = split(",", ($jdownloader{'Smbusers'} || "") ); |
| + | |
| + | $OUT .= "[jdownloader]\n"; |
| + | $OUT .= "comment = jdownloader download folder\n"; |
| + | $OUT .= "path = /var/lib/jdownloader\n"; |
| + | |
| + | $OUT .= "valid users \= admin "; |
| + | foreach my $jdownloader_smb_users (@jdownloader_smb_users) |
| + | { |
| + | $OUT .= " $jdownloader_smb_users"; |
| + | } |
| + | $OUT .="\n"; |
| + | $OUT .= "force user = jdownloader\n"; |
| + | $OUT .= "force group = jdowloader\n"; |
| + | $OUT .= "read only = no\n"; |
| + | $OUT .= "browsable = yes\n"; |
| + | $OUT .= "writable = yes\n"; |
| + | $OUT .= "create mode = 0644\n"; |
| + | $OUT .= "directory mask = 0755\n"; |
| + | |
| + | } |
| + | } |
| + | |
| + | then |
| + | signal-event workgroup-update |
| + | |
| + | and create the download folder and allow the jdownloader user |
| + | mkdir /var/lib/jdownloader |
| + | chown jdownloader:jdownloader /var/lib/jdownloader -R |
| + | |
| + | ====adjust setting in Jdownloader==== |
| + | got to http://my.jdownloader.org, fill your credentials, go to your jdownloader instance (you can have several instance at my.jdownloader.org), go to the 'settings' (upper right) and then 'Advanced Settings' (on the left) |
| + | |
| + | * sort by '''General - Default Download Folder''' and set '''/var/lib/jdownloader''' |
| + | * sort by '''Extraction - Delete Archive Downloadlinks After Extraction''' and valid the checkbox |
| + | * sort by '''Extraction - Delete Archive Files After Extraction Action''' and select the file deletion of your choice |
| + | * sort by '''General - Auto Start Download Option''' and choose 'always' |
| + | * sort by '''General - Show Countdownon Auto Start Downloads''' and invalid the checkbox |
| + | |
| + | of course you have plenty of different settings, take time to see them. add yours here if you think that they are valuable |
| | | |
| ===Usage=== | | ===Usage=== |
| * web interface | | * web interface |
− | Your web Interface is reachable at http://my.jdownloader.org | + | Your web Interface is reachable at http://my.jdownloader.org, fill your credentials |
| | | |
| * control the service | | * control the service |
Line 171: |
Line 209: |
| service jdownloader stop | | service jdownloader stop |
| | | |
| + | * retrieve your downloads by samba |
| + | at first only the user '''admin''' is allowed to reach the samba share jdownloader, but you can add more users or groups (see below) |
| + | |
| + | * allow more users/groups to use the samba share |
| + | you need to set your group with a '@' |
| + | |
| + | config setprop jdownloader Smbusers user1,user2,@group1,@group2 |
| + | signal-event workgroup-update |
| + | |
| + | ===Debug=== |
| + | launch manually in your terminal the command below and see what is wrong. |
| + | su -s /bin/sh jdownloader -c 'java -Djava.awt.headless=true -jar /usr/share/JD2/JDownloader.jar' |
| [[Category:Howto]] | | [[Category:Howto]] |