[QPKG] RunLast

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

[QPKG] RunLast

Post by OneCD » Sat Jan 05, 2019 11:58 am

Image

Description

RunLast creates an environment to run commands or shell-scripts after QPKG re-integration has occurred during QTS NAS bootup.

This allows you to run scripts dependent on QPKGs during QTS startup.

What it does

This package creates a scripts directory in the package installation path. Your scripts must be placed here. When this QPKG starts, it processes each script, storing any stdout and stderr to a log, viewable via the QTS UI.

How to install
  • It’s available in the Qnapclub Store!
  • Click here to find out how to add the Qnapclub Store as an App Center repository in QTS.
Notes
  • When this package is installed, there's not much to see. Find the package icon and click the 'Open' button to display the current log file - any output from your scripts will be shown here.
  • The log is viewable via your web browser but is not a real web document, so it can change without your browser noticing. Whenever viewing the log, ensure you force a page refresh: CTRL+F5.
  • The source for this project can be found on GitHub.
  • Changelog

production NAS: TS-569 Pro with Debian 9.8 'Stretch' (power on/off times are < 1 minute).
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20181227

one.cd.only@gmail.com

Image Image Image Image

User avatar
peelos
Easy as a breeze
Posts: 412
Joined: Sun Jun 26, 2016 9:28 pm

Re: [QPKG] RunLast

Post by peelos » Sat Jan 05, 2019 6:15 pm

Many thanks OneCD, will be interesting to read peoples use cases for this App.
TVS-1282-i7K-40G / 4 x 500Gb SSD 2.5" / 2 x 500Gb M.2 SSD / 8 x 4Tb WD Red / Corsiar H5-SF Watercooling / 3 x 80mm PWM Noctua fans / Corsair 600W PSU / Asus Turbo GTX 1060 6GB GPU

User avatar
OneCD
Ask me anything
Posts: 5844
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD » Sun Jan 06, 2019 8:22 am

No worries @peelos, hopefully it will have some value. I’ll be testing and tweaking it for a while. ;)

production NAS: TS-569 Pro with Debian 9.8 'Stretch' (power on/off times are < 1 minute).
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20181227

one.cd.only@gmail.com

Image Image Image Image

L3rd
Know my way around
Posts: 125
Joined: Thu Sep 20, 2007 8:11 pm

Re: [QPKG] RunLast

Post by L3rd » Sat Jan 19, 2019 4:52 am

I'm using the qpkg on a TS-212p to re-enable a swap-file stored on a usb key after each reboot:

Code: Select all

swapon /share/external/sdr1/myswapfile
Thanks!
NAS:
QNAP TVS-682 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .FW: 4.3.5.0760 Build 20181114
QNAP TS-509 Pro upgraded to Xeon L5408(SLBBT)/4GB . . . . . .FW: 4.2.6 Build 20181026 (TS-809 Pro)
QNAP TS-109 Pro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .FW: 3.3.3 build 1003
QNAP QG-103N QGenie . . . . . . . . . . . . . . . . . . . . . . . . . . . . .FW: 3.2.3 (2018/08/10)

User avatar
OneCD
Ask me anything
Posts: 5844
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD » Sat Jan 19, 2019 4:57 am

L3rd wrote:
Sat Jan 19, 2019 4:52 am
I'm using the qpkg on a TS-212p to re-enable a swap-file stored on a usb key after each reboot:
Nice! :D

production NAS: TS-569 Pro with Debian 9.8 'Stretch' (power on/off times are < 1 minute).
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20181227

one.cd.only@gmail.com

Image Image Image Image

User avatar
Don
Guru
Posts: 11621
Joined: Thu Jan 03, 2008 4:56 am
Location: Long Island, New York
Contact:

Re: [QPKG] RunLast

Post by Don » Sun Jan 20, 2019 5:27 am

Nice. I like the idea of the script directory. I am assuming that you should name your files so they sort in the order you want them to execute? Like the following for example.

01-StartDNSMASq.sh
02-Aliases.sh
03-xxx.sh
04-aaa.sh
Read the Online Manuals and use the forum search feature before posting.

It is a recommended to use RAID and have external backups. RAID will protect you from disk failure, keep your system running, and data accessible while the disk is replaced and the RAID rebuilt. Backups will allow you to recover data that is lost or corrupted, or from system failure. One does not replace the other.

Submit bugs and feature requests to QNAP via their Helpdesk app.

NAS: TVS-882BR | F/W: 4.3.6.0805 | 40GB | 2 x M.2 SATA RAID 1 (System/VMs) | 4 x M.2 NMVe QM2-4P-384A RAID 5 (Cache) | 5 x 4TB HDD RAID 6 (Data) | 1 x Blu-ray
NAS: TVS-663 | F/W: 4.3.6.0883 | 16GB | 2 x M.2 NMVe QM2-2P RAID 1 (Cache) | 4 x 4TB RAID 5
Apps: Boinc, Squid, DNSMasq, PLEX, iDrive, QVPN, QLMS, MP3fs, HBS, Entware, DLstation, +others

User avatar
OneCD
Ask me anything
Posts: 5844
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD » Sun Jan 20, 2019 5:35 am

Don wrote:
Sun Jan 20, 2019 5:27 am
I am assuming that you should name your files so they sort in the order you want them to execute?
Yes, that's correct (I really need to add a bit more detail to the first post).

@Don, while you're there, I've been toying with the idea of creating a symlink to a location that's easier for users to get to. Maybe [/scripts/runlast/]?

What are your thoughts?

production NAS: TS-569 Pro with Debian 9.8 'Stretch' (power on/off times are < 1 minute).
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20181227

one.cd.only@gmail.com

Image Image Image Image

User avatar
Don
Guru
Posts: 11621
Joined: Thu Jan 03, 2008 4:56 am
Location: Long Island, New York
Contact:

Re: [QPKG] RunLast

Post by Don » Sun Jan 20, 2019 5:39 am

Where would "/scripts/runlast/" be located?
Read the Online Manuals and use the forum search feature before posting.

It is a recommended to use RAID and have external backups. RAID will protect you from disk failure, keep your system running, and data accessible while the disk is replaced and the RAID rebuilt. Backups will allow you to recover data that is lost or corrupted, or from system failure. One does not replace the other.

Submit bugs and feature requests to QNAP via their Helpdesk app.

NAS: TVS-882BR | F/W: 4.3.6.0805 | 40GB | 2 x M.2 SATA RAID 1 (System/VMs) | 4 x M.2 NMVe QM2-4P-384A RAID 5 (Cache) | 5 x 4TB HDD RAID 6 (Data) | 1 x Blu-ray
NAS: TVS-663 | F/W: 4.3.6.0883 | 16GB | 2 x M.2 NMVe QM2-2P RAID 1 (Cache) | 4 x 4TB RAID 5
Apps: Boinc, Squid, DNSMasq, PLEX, iDrive, QVPN, QLMS, MP3fs, HBS, Entware, DLstation, +others

User avatar
OneCD
Ask me anything
Posts: 5844
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [QPKG] RunLast

Post by OneCD » Sun Jan 20, 2019 7:40 am

If it would help you test it, run this to create the symlink:

Code: Select all

mkdir /scripts && ln -s $(getcfg RunLast Install_Path -f /etc/config/qpkg.conf)/scripts /scripts/runlast

production NAS: TS-569 Pro with Debian 9.8 'Stretch' (power on/off times are < 1 minute).
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20181227

one.cd.only@gmail.com

Image Image Image Image

Post Reply

Return to “Community Apps”