[QPKG] RunLast

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.

  • Important: RunLast is no-longer effective on QTS 5.2.0 or-later, as these QTS versions have been modified to start QPKGs asynchronously. I can’t force QTS to load QPKGs in a specific order anymore.

  • QPKGs must now make use of the ‘Dependency’ key. This requires QPKG developers to name any other QPKGs their QPKG depends-on and to set this key post-install with the other QPKG names as the key value.

  • If you’re running QTS 5.2.0 or-later, you can uninstall RunLast. However, this package will continue to be maintained for those running older QTS versions.

What it does

This package creates a scripts directory in the package installation path:

  • init.d
  • scripts

Place your SysV-style scripts in the init.d directory. These will be executed with a start parameter after NAS startup, and with a stop parameter before NAS shutdown. Scripts in the scripts directory will be executed only during startup, and always after the custom init.d start script execution.

Installation

  • Available in the MyQNAP repo, and can also be installed via the sherpa package manager.

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 stdout and stderr from your scripts will be shown here.

  • The log file 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.

  • To jump to the scripts directory:

cd $(getcfg RunLast Scripts_Path -f /etc/config/qpkg.conf)
  • Or, to jump to the init.d directory:
cd $(getcfg RunLast SysV_Path -f /etc/config/qpkg.conf)