fbpx

Monitoring / NGINX

Nginx Amplify Automatic Updates on CentOS/RHEL 7

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

It is recommended to continuously update Nginx Amplify agent. As we want to ease our lives, how can we setup automatic updates for the Amplify agent? I will share how I do it on my servers in this short note.

Yum-Cron

First, I have looked into leveraging yum-cron for the job. However, I do not want to risk updating everything just for Amplify agent. The yum-cron script, unfortunately, lacks any ways to specify the packages you want to be automatically updated.

So after giving it a thought, I came to an easy and simple solution of “why not” series.

Trivial solution

We can create a simple cron job to auto-update only Nginx Amplify.

Login as root user on your system and type:

crontab -e 

Now simply paste in the following line:

@daily /usr/bin/yum --assumeyes --quiet --errorlevel=0 update nginx-amplify-agent 2>&1

That’s it. Your Amplify agent has been set up to update automatically.
Some insight on the flags in use for the yum:

  • --assumeyes will accept updates for you. FYI: I know I can keep things short by using -y instead, but I always prefer a longer option so I can easily tell what each option does. Readability!
  • --quiet will suppress most of the standard output
  • --errorlevel=0 will output critical errors. As per yum documentation, this is recommended for cron use
  • 2>&1 will ensure that errors are sent to stdout (cron will use that for emailing)

So now you have it. Nginx Amplify will automatically and silently update for you. Provided that you have set up your system properly, you will get an email alert, should any problem occur during automatic update.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.