JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 08.01.2022, 13:27
xele3628iw xele3628iw is offline
Super Loader
 
Join Date: Apr 2010
Location: Greece
Posts: 27
Default Restart again after update

Hello, how can I cause the jdownloader to restart a second time after an update?

i found the following code but the last line does not do what it says

Code:
/*
Name: Update and Re-Apply Theme

Version: 1.0.1

Author: https://github.com/andrewjmetzger

Description: Check for and apply updates periodically if JDownloader 2 is idle,
and then restart JDownloader 2 one more time to apply the dark theme properly.

Trigger Required: "Interval" (Recommended: 600000 (10 mins.) or more)

Synchronous execution: Yes (checked)
*/

if (
callAPI("update", "isUpdateAvailable") &&       // an update is available, and
!callAPI("linkcrawler", "isCrawling") &&        // LinkCrawler is idle, and
!callAPI("linkgrabberv2", "isCollecting") &&    // LinkGrabber is idle, and
!callAPI("extraction", "getQueue").length &&    // nothing is being extracted, then
isDownloadControllerIdle()                      // if no downloads are running...
) {
callAPI("update", "restartAndUpdate");              // Check for and apply an update, then
callAPI("system", "restartJD");                     // restart JDownloader 2 again to fix the theme
}
Is there any correction you can suggest to me
Reply With Quote
  #2  
Old 08.01.2022, 15:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,415
Default

Quote:
Originally Posted by xele3628iw View Post
how can I cause the jdownloader to restart a second time after an update?
Code:
/*
    Restart after update
    Trigger : JDownloader started
*/

var restart = true;
var cur = getPath(JD_HOME + "/build.json");
var old = getPath(JD_HOME + "/tmp/build.json");

try {
    restart = readFile(old) != readFile(cur);
} catch (e) {};


if (restart) {
    old.delete();
    cur.copyTo(old.parent);
    callAPI("system", "restartJD");
}
Reply With Quote
  #3  
Old 08.01.2022, 16:33
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,415
Default

Alternate version:
Code:
/*
    Restart after update
    Trigger : JDownloader started
*/

var list = "";
var file = JD_HOME + "/revisions.txt";
var revision = callAPI("jd", "getCoreRevision");

try {
    list = readFile(file);
} catch (e) {};

if (list.indexOf(revision) == -1) {
    writeFile(file, revision + "\r\n", true);
    callAPI("system", "restartJD");
}
Reply With Quote
  #4  
Old 08.01.2022, 21:53
xele3628iw xele3628iw is offline
Super Loader
 
Join Date: Apr 2010
Location: Greece
Posts: 27
Default

@mgpai thank you very much for your prompt reply
Reply With Quote
  #5  
Old 10.01.2022, 16:45
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 75,028
Default

@xele3628iw: out of interest, why another restart?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #6  
Old 11.01.2022, 09:12
xele3628iw xele3628iw is offline
Super Loader
 
Join Date: Apr 2010
Location: Greece
Posts: 27
Default

Quote:
Originally Posted by Jiaz View Post
@xele3628iw: out of interest, why another restart?
Hi Jiaz
because I use BlackEye as a theme did not apply properly after update,
so with the second restart it is applied correctly.
Reply With Quote
  #7  
Old 11.01.2022, 09:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,415
Default

@jiaz: Pending ticket.

Reply With Quote
  #8  
Old 12.01.2022, 15:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 75,028
Default

@xele3628iw: Thanks for the feedback. That makes sense

@mgpai: time to get this fixed!
__________________
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 11:03.
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 - 2022, Jelsoft Enterprises Ltd.