{"id":263,"date":"2021-07-23T12:26:48","date_gmt":"2021-07-23T12:26:48","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/the-check_cpanel_rpms-script\/"},"modified":"2021-07-23T12:26:48","modified_gmt":"2021-07-23T12:26:48","slug":"the-check_cpanel_rpms-script","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/the-check_cpanel_rpms-script\/","title":{"rendered":"The check_cpanel_rpms Script"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>The <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script scans every installed RedHat\u00ae Package Manager (RPM) file on your server for problems. This script can also reinstall any affected cPanel &#038; WHM RPMs to repair them.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>To run the <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script nightly, use the <em>Maintenance cPanel RPM Check<\/em> and <em>Maintenance cPanel RPM Digest Check<\/em> settings in the <em>Software<\/em> section of WHM\u2019s Tweak Settings interface (<em>WHM &gt;&gt; Home &gt;&gt; Server Configuration &gt;&gt; Tweak Settings<\/em>).<\/p>\n<\/p><\/div>\n<\/div>\n<h2 id=\"script-functions\">Script functions<\/h2>\n<p>The <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script performs four basic functions each time that it runs:<\/p>\n<ol>\n<li>Discovers missing RPMs.<\/li>\n<li>Tracks RPMs that are out-of-date and need updates.<\/li>\n<li>Checks for any altered RPMs. Altered RPMs meet any of the following conditions:\n<ul>\n<li>Unordered sub-list.<\/li>\n<li>Unordered sub-list.<\/li>\n<li>Their mode has changed.<\/li>\n<li>An MD5 checksum does not exist.<\/li>\n<li>They are symlinks, and the file points to the wrong path.<\/li>\n<li>They are missing.<\/li>\n<\/ul>\n<\/li>\n<li>Checks whether to uninstall any cPanel-managed RPMs.<\/li>\n<\/ol>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>The <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script runs for a few minutes. If it does not detect any problems, it will <strong>not<\/strong> produce any output and exit to the command prompt.<\/li>\n<li>The <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script does <strong>not<\/strong> check for problems with incorrect file permissions.<\/li>\n<\/ul><\/div>\n<\/div>\n<h2 id=\"run-the-script\">Run the script<\/h2>\n<p>To run the <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script on the command line, use the following format:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms <span style=\"color:#f92672\">[<\/span>options<span style=\"color:#f92672\">]<\/span><\/code><\/pre>\n<\/div>\n<h3 id=\"options\">Options<\/h3>\n<p>You can use the following options with the <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script:<\/p>\n<table>\n<thead>\n<tr>\n<th>Options<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>--download-only<\/code><\/td>\n<td>Downloads any missing packages to the <code>\/usr\/local\/cpanel\/tmp\/rpm.versions<\/code> file, then exits.<\/p>\n<ul>\n<li>The script downloads a new copy of a package <strong>only<\/strong> if the package is missing.<\/li>\n<li>If the package already exists, the script lists the package name <strong>only<\/strong> and then exits.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td><code>--fix<\/code><\/td>\n<td>Shows any problems and automatically corrects them.<\/td>\n<\/tr>\n<tr>\n<td><code>--list-only<\/code><\/td>\n<td>Lists altered RPMs and then exits.<\/td>\n<\/tr>\n<tr>\n<td><code>--long-list<\/code><\/td>\n<td>Shows the altered RPMs and files in an easily-parsed format.<\/td>\n<\/tr>\n<tr>\n<td><code>--no-broken<\/code><\/td>\n<td>Installs missing RPMs and uninstalls unneeded RPMs. The script will not check for broken RPMs.<\/td>\n<\/tr>\n<tr>\n<td><code>--no-digest<\/code><\/td>\n<td>Performs a size validation.<\/p>\n<ul>\n<li>This option will not report altered RPMs.<\/li>\n<li>If the script detects an altered RPM, but the file size is identical, this option will not report the change.<\/li>\n<li>This option applies the <code>--nodigest<\/code> and <code>--nomd5<\/code> options to the <code>rpm -Vv<\/code> check.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td><code>--nodir<\/code><\/td>\n<td>The script will not read the <code>\/var\/cpanel\/rpm.versions.d<\/code> directory.<\/td>\n<\/tr>\n<tr>\n<td><code>--notify<\/code><\/td>\n<td>Sends a notification that lists any altered RPMs. Then, the script describes any actions that the system performed.<\/td>\n<\/tr>\n<tr>\n<td><code>--targets<\/code><\/td>\n<td>Filters RPMs based on provided targets (comma-delimited).<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"example\">Example<\/h3>\n<p>For example, to use the <code>--fix<\/code> option, run the following command:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms --fix<\/code><\/pre>\n<\/div>\n<h2 id=\"checks-performed\">Checks performed<\/h2>\n<p>The <code>\/usr\/local\/cpanel\/scripts\/check_cpanel_rpms<\/code> script runs the <code>rpm -Vv<\/code> check on all cPanel-managed RPMs. This checks for changes in the files since their installation. The script does not check configuration and documentation files.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>If the output indicates that only <code>Mode<\/code> or <code>mTime<\/code> have changed, the script will not report that as an altered RPM.<\/p>\n<\/p><\/div>\n<\/div>\n<p>The output of the <code>rpm -Vv<\/code> check lists the following changes:<\/p>\n<table>\n<thead>\n<tr>\n<th>Check<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>S<\/code><\/td>\n<td>File size differs.<\/td>\n<\/tr>\n<tr>\n<td><code>M<\/code><\/td>\n<td>Mode differs. This includes permissions and file type.<\/td>\n<\/tr>\n<tr>\n<td><code>5<\/code><\/td>\n<td>MD5 sum differs.<\/td>\n<\/tr>\n<tr>\n<td><code>D<\/code><\/td>\n<td>Device major or minor number mismatch.<\/td>\n<\/tr>\n<tr>\n<td><code>L<\/code><\/td>\n<td><code>readLink(2)<\/code> path mismatch.<\/td>\n<\/tr>\n<tr>\n<td><code>U<\/code><\/td>\n<td>User ownership differs.<\/td>\n<\/tr>\n<tr>\n<td><code>G<\/code><\/td>\n<td>Group ownership differs.<\/td>\n<\/tr>\n<tr>\n<td><code>T<\/code><\/td>\n<td><code>mTime<\/code> differs. <code>mTime<\/code> refers to the last time the file was modified.<\/td>\n<\/tr>\n<tr>\n<td><code>P<\/code><\/td>\n<td>Capabilities differ.<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview The \/usr\/local\/cpanel\/scripts\/check_cpanel_rpms script scans every installed RedHat\u00ae Package Manager (RPM) file on your server for problems. This script can also reinstall any affected cPanel &#038; WHM RPMs to repair them. Note: To run the \/usr\/local\/cpanel\/scripts\/check_cpanel_rpms script nightly, use the Maintenance cPanel RPM Check and Maintenance cPanel RPM Digest Check settings in the Software section &hellip;<\/p>\n","protected":false},"author":1,"featured_media":264,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/263"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=263"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/263\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/264"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}