[QPKG] RunLast

This is the best place for community developers to publish their genius work. Your Apps enrich the QNAP Turbo NAS.
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

Turbo_112 wrote: Sun Nov 15, 2020 2:30 am The Qnap log says Starting and Ending the scripts, but it gives no username in the log like other apps.
Can you please post your RunLast log?

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Turbo_112
Starting out
Posts: 22
Joined: Wed May 07, 2014 2:26 am
Location: The Netherlands

Re: [QPKG] RunLast

Post by Turbo_112 »

Script 4 is the nzbget script. All the scripts are working when executed in Putty in the RunLast script directory. Logged in as admin.

RunLast (20201106)
[Sat Nov 14 19:54:03 CET 2020] begin "start" scripts ...
[Sat Nov 14 19:54:03 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/1-python2.sh'" ...
[Sat Nov 14 19:54:04 CET 2020] => exitcode: (1)
[Sat Nov 14 19:54:04 CET 2020] => stdout: ""
[Sat Nov 14 19:54:04 CET 2020] => stderr: ""
[Sat Nov 14 19:54:04 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/2-python3.sh'" ...
[Sat Nov 14 19:54:04 CET 2020] => exitcode: (1)
[Sat Nov 14 19:54:04 CET 2020] => stdout: ""
[Sat Nov 14 19:54:04 CET 2020] => stderr: ""
[Sat Nov 14 19:54:04 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/3-boot.sh'" ...
[Sat Nov 14 19:54:04 CET 2020] => exitcode: (1)
[Sat Nov 14 19:54:04 CET 2020] => stdout: ""
[Sat Nov 14 19:54:04 CET 2020] => stderr: ""
[Sat Nov 14 19:54:04 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/4-nzbget.sh'" ...
[Sat Nov 14 19:54:04 CET 2020] => exitcode: (1)
[Sat Nov 14 19:54:04 CET 2020] => stdout: ""
[Sat Nov 14 19:54:04 CET 2020] => stderr: ""
[Sat Nov 14 19:54:04 CET 2020] end "start" scripts
You do not have the required permissions to view the files attached to this post.
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

Turbo_112 wrote: Sun Nov 15, 2020 5:34 pm [Sat Nov 14 19:54:04 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/4-nzbget.sh'" ...
[Sat Nov 14 19:54:04 CET 2020] => exitcode: (1)
[Sat Nov 14 19:54:04 CET 2020] => stdout: ""
[Sat Nov 14 19:54:04 CET 2020] => stderr: ""
This shows each script exited with an error, but no stderr was captured. I have a sneaking suspicion this is another example of QTS not creating a symlink at [/dev/fd] again. Recently saw the same thing in sherpa. :S

Are you able to edit the [runlast.sh] script? If so, please add this line before the Init() function:

Code: Select all

[[ ! -e /dev/fd ]] && ln -s /proc/self/fd /dev/fd   # sometimes, '/dev/fd' isn't created by QTS. Don't know why.
... then reboot your NAS to test. Please advise if it works. I'll add it into the next RunLast QPKG build if-so.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Turbo_112
Starting out
Posts: 22
Joined: Wed May 07, 2014 2:26 am
Location: The Netherlands

Re: [QPKG] RunLast

Post by Turbo_112 »

Thanks, I add the code to runlast.sh. It's now executing the scripts again.
This is the result:

───────────────────────────────────────────────────────
RunLast (20201106)
[Mon Nov 16 11:02:04 CET 2020] begin "start" scripts ...
[Mon Nov 16 11:02:05 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/1-python2.sh'" ...
[Mon Nov 16 11:02:05 CET 2020] => exitcode: (0)
[Mon Nov 16 11:02:05 CET 2020] => stdout: ""
[Mon Nov 16 11:02:05 CET 2020] => stderr: ""
[Mon Nov 16 11:02:05 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/2-python3.sh'" ...
[Mon Nov 16 11:02:05 CET 2020] => exitcode: (0)
[Mon Nov 16 11:02:05 CET 2020] => stdout: ""
[Mon Nov 16 11:02:05 CET 2020] => stderr: ""
[Mon Nov 16 11:02:05 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/3-boot.sh'" ...
[Mon Nov 16 11:02:06 CET 2020] => exitcode: (0)
[Mon Nov 16 11:02:06 CET 2020] => stdout: ""
[Mon Nov 16 11:02:06 CET 2020] => stderr: ""
[Mon Nov 16 11:02:06 CET 2020] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/4-nzbget.sh'" ...
[Mon Nov 16 11:02:07 CET 2020] => exitcode: (0)
[Mon Nov 16 11:02:07 CET 2020] => stdout: ""
[Mon Nov 16 11:02:07 CET 2020] => stderr: ""
[Mon Nov 16 11:02:07 CET 2020] end "start" scripts
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

Turbo_112 wrote: Mon Nov 16, 2020 6:14 pm Thanks, I add the code to runlast.sh. It's now executing the scripts again.
Great! I'll release a new build shortly. Thank you. :D

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

My Use Case:
I've made a copy of calibre-web in the .qpkg directory: "calibre-web-0.6.11"
I need to run nohup python cps.py at start-up to ensure the webgui remains open while the NAS is up.


I've installed RunLast and made a scripts called cali.sh (chmod'd 777), which contains the below:

#!/bin/sh
nohup python ../../calibre-web-0.6.11/cps.py


Am I going about this right or missing something?
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

rs1001 wrote: Fri Apr 30, 2021 4:14 pm I've installed RunLast and made a scripts called cali.sh (chmod'd 777), which contains the below:

#!/bin/sh
nohup python ../../calibre-web-0.6.11/cps.py


Am I going about this right or missing something?
'nohup' isn't included in QTS. Did you install it via Entware? If so, please use the Entware init system to start your script.

Is there a ''--daemon" mode available for that application?

Additionally, that script shows you're specifying a relative path to [cps.py]. It's safer to specify an absolute path, as you can't be sure which directory will be current when your script is executed. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

I did indeed have to install via Entware since Qnapware is so 90's.

I'm using the instructions here & trying to get it to work, installing things via Entware as required:
https://github.com/janeczku/calibre-web
I've got it to work by manually starting up but need it at start-up.
I'll read more about the Entware init system. I didn't know it was an option.

My next task will be trying to get LDAP working -- this is to replace LL for me.
I'm finding that too heavy for my needs.
Don't suppose you want to bash out a version of this on sherpa? -- *cheeky-ask*
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

https://github.com/janeczku/calibre-web ... e-on-Linux
This did show promise, but I read on the forums that it's dangerous to systemctl. // Unsure
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

rs1001 wrote: Sat May 01, 2021 8:42 pm I'll read more about the Entware init system. I didn't know it was an option.
Yup, see here for instructions: viewtopic.php?p=787641#p787641
rs1001 wrote: Sat May 01, 2021 8:42 pm Don't suppose you want to bash out a version of this on sherpa? -- *cheeky-ask*
There's already a package for this on the Qnapclub Store (hopefully this page loads properly for you - it's looks a bit corrupt on my end... :roll: ): https://www.qnapclub.eu/index.php/en/qpkg/1113
rs1001 wrote: Sat May 01, 2021 8:45 pm https://github.com/janeczku/calibre-web ... e-on-Linux
This did show promise, but I read on the forums that it's dangerous to systemctl. // Unsure
QTS doesn't include SystemD, so it's not possible to use SystemD service files, and also means: no 'systemctl' binary is available. ;)

QTS still uses the older SystemV-style init files to start and stop daemons. The basic structure is shown here: https://github.com/OneCDOnly/PackageTem ... package.sh

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

Okay, good to know that it's a non-starter. I'll stop trying to force-feed systemctl then.
If I've understood you right, shifting the script called SCali.sh to /opt/etc/init/d containing:

#!/bin/sh
nohup python /share/CACHEDEV1_DATA/.qpkg/calibre-web-0.6.11/cps.py

... should do the trick.

Restarting, fingers-crossed.

>> I did see that qpkg, but I'm being tight with how many things I install. This has an Apache80 dependency.

I'll be bothering you with LDAP woes soon enough.
Thanks for the help once again.
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

Well, the startup for calibre worked wonders.
And it turns out that ODPS works in a way that I won't be needing LDAP. -- so that's a big victory.

Next up, I got adventurous and tried to upgrade Jackett to the source (not relying on Mono)
Also works.. Followed these instructions: https://github.com/Jackett/Jackett#inst ... nux-amdx64
and with my newfound knowledge shifted that to a script in the init.d folder too.

#!/bin/sh
nohup /share/CACHEDEV1_DATA/.qpkg/Jackett/.jackett &

This one won't start up though. In addition, when I manually start it up, settings prior like indexers & port change don't persist.
It's like a fresh install every time. Would this be better suited using RunLast?
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
User avatar
OneCD
Guru
Posts: 12010
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD »

rs1001 wrote: Thu May 06, 2021 4:42 am This one won't start up though. In addition, when I manually start it up, settings prior like indexers & port change don't persist.
It's like a fresh install every time. Would this be better suited using RunLast?
Sounds like you may need to run it with some configuration parameters. Many daemons require a config file to be specified at the time you instance them. However, the method and file format will be application-specific, so you'll need to dig-into the Jackett documentation to see how this should be done. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

In fiddling with this, I've managed to do something catastrophic.
I got an error that mnt was full and ram coked out. Fans off.

Restarted twice and ALL my qpkg's are gone on the QTS "App Centre" interface!
Thankfully all the media is there, but I still might cry for a bit.
There's poem semblance of hope I haven't lost all my settings as the files still exist in .qpkg
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
rs1001
Getting the hang of things
Posts: 72
Joined: Thu Jun 18, 2015 11:44 am

Re: [QPKG] RunLast

Post by rs1001 »

[/share/CACHEDEV1_DATA/.qpkg/COPS] # Usage: ./COPS.sh {start|stop|restart}
./COPS.sh start
COPS is disabled.

lol. Ain't that the truth.
QNAP TS-653 Pro -- with 16Gb RAM
6 * Western Digital WD60EFRX WD Reds (RAID5) as a Single 27.1TB Volume
Firmware: QTS 5.0.1.2277
Post Reply

Return to “Community Apps”