Auto Update With the LSUP Command

From the Support Desk 01: Auto Update LiteSpeed with lsup

Welcome to our new blog series: From the Support Desk! From time to time, our support staff will drop in here to impart tips, how-to’s and other pearls of LiteSpeed wisdom.

Today’s topic is: Auto Update LiteSpeed with the LSUP Command

LiteSpeed Web Server’s lsup command is used primarily to update LSWS to the latest version from the command line. But now, with the addition of a tier system, stable version updates may be safely automated from your system cron! Read on to learn about the new Stable Tier, how it differs from the Edge Tier, and how to use this much-requested new feature.

Basic Usage

The lsup command is a simple way to update LiteSpeed Web Server from the command line, and allows the possibility of upgrading LSWS installations in bulk with a single command.

You can find lsup located at $SERVER_ROOT/admin/misc/lsup.sh. In most CentOS installations, that would mean this is the full command:

/usr/local/lsws/admin/misc/lsup.sh

Running lsup without parameters will automatically upgrade your installation of LiteSpeed Web Server to the latest stable release, assuming you are following the Stable Tier (more on that later).

Automation

The new tier system allows you to automate your LSWS Stable Tier updates. Safely set up a cron job to keep all of your LSWS installations current with the latest stable version.

To automate Stable Tier updates in the cron, use lsup.sh with no parameters.
IMPORTANT: If you have previously set up a cron job for lsup.sh, please verify that there are no parameters included!

Other Options

The following parameters are available for use with lsup:

  • -f: If you already have the most recent stable version installed, the basic, no-parameter lsup command will abort. The -f option forces lsup to install the latest edge build.
  • -v: You can control what version of LSWS you install with the -v option, followed by a version number. For example: ./lsup.sh -v 5.3.6. This will allow you to downgrade to an older version if you experience a problem with the current one, or upgrade to a specific edge version.
  • -b: This parameter designates a build number. All versions start from build 0. lsup will automatically upgrade to the latest build of the designated version if -b is not set. (Note: this option is only available for LSWS versions 5.0 and higher.) To view what build you are currently using, display the contents of /usr/local/lsws/autoupdate/build.

If you are looking to upgrade/downgrade to a particular version or build, but don’t know the numbers, you can look them up on our wiki.

Usage Examples

You can use lsup to force updates to any version or build.

Version 5.3.7:

/usr/local/lsws/admin/misc/lsup.sh -f -v 5.3.7

Version 5.3.7 build 4:

/usr/local/lsws/admin/misc/lsup.sh -f -v 5.3.7 -b 4

Edge version 5.4RC3:

/usr/local/lsws/admin/misc/lsup.sh -f -v 5.4RC3

IMPORTANT: Please never use these other parameters when automating updates via cron! These are only for command-line use.

Stable Tier vs. Edge Tier

So about that new tier system… Starting from version 5.3.7 build 4, the lsup command will be able to distinguish between two tiers: Stable and Edge. (This tier system is not available on older versions – please upgrade, if you want to use it.)

lsup.sh is for updating to the most recent stable release (Stable Tier).

lsup.sh -f is for forcing an update to the most cutting edge build available (Edge Tier).

follow_stable

The behavior of lsup is influenced by the new follow_stable marker, located in /usr/local/lsws/autoupdate/follow_stable.

The first time you upgrade to v5.3.7 b4 (or later), this marker will be automatically created, ensuring that your auto-updates will continue to default to the Stable Tier.

Edge Builds

If you like living on the edge, you can use lsup.sh -f. The -f parameter installs the edge build, which is the absolute latest available, and it will remove the follow_stable marker, if it exists.

If you change your mind and want to go back to following the Stable Tier, simply create the follow_stable marker again, like so:

touch /usr/local/lsws/autoupdate/follow_stable

Specific Versions

You can also force a particular version to install, such as with lsup.sh -f -v <version>. In this case, as well, the follow_stable marker will be removed, as long as the specified version is different than the latest stable version.

Conversely, if the follow_stable marker doesn’t already exist, and the specified version is the same as the latest stable version, the marker will be created.

Here’s a handy table to illustrate how all of these elements work together:

follow_stable marker exists follow_stable doesn’t exist
lsup.sh with no parameters latest Stable Tier build installed nothing is installed
marker may be created*
lsup.sh -f latest Edge Tier build installed
marker deleted
latest Edge Tier build installed
lsup.sh -f -v <version> <version>’s latest build installed
marker may be deleted**
<version>’s latest build installed
marker may be created***
lsup.sh -f -v <version> -b <build> <version> <build> installed
marker may be deleted**
<version> <build> installed
marker may be created***

*if currently-installed version is the same as the latest stable version and build
**if specified <version> and/or <build> is different than the latest stable version and build.
***if specified <version> and/or <build> is the same as the latest stable version and build.

Using follow_stable to Control Cron Updates

As you can see from the table above, lsup.sh with no parameters will always install the latest stable version, as long as the follow_stable marker exists. If the marker does not exist, then lsup.sh with no parameters installs nothing.

This is important. It means that even when you have temporarily installed an edge build or downgraded to an older version, you can leave your daily cron job in place. When you are purposely working with a specific LSWS version, you don’t want the cron to come along and change everything. You want it to do nothing until you are ready.

Once your specific-version work has concluded, you can put the marker back in place and regular updates will resume automatically.

Alternately, if you are working with an edge build, you can simply wait for that edge build to be added to the Stable Tier. The next time lsup runs, the marker will automatically be recreated and stable updates will resume.

Conclusion

With the release of LSWS v5.3.7 b4, it is now possible to automate LiteSpeed Web Server updates through a regular system cron job. We hope this article has given you a full understanding of how the new tier system works, but if you have any questions, please leave a comment. We’ll be happy to help. See you next time!



Related Posts


Comments