MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
June
Sun Mon Tue Wed Thu Fri Sat
           
18 19 20 21 22
23 24 25 26 27 28 29
30            
2024
Months
Jun
Jul Aug Sep
Oct Nov Dec


Thu, Mar 14, 2024 9:29 pm

Checking fan speeds and temperatures in a Linux system

A user reported the sound from a Linux CentOS server was loud. I thought the noise was likely from a fan in the system. The lm_sensors package provides the capability to check central processing unit (CPU) temperatures and fan speeds for systems running a Linux operating system. I first checked to see if the package was installed and found it was installed.

$ rpm -qi lm_sensors
Name        : lm_sensors
Version     : 3.3.4
Release     : 11.el7
Architecture: x86_64
Install Date: Sat 15 Oct 2016 12:14:14 PM EDT
Group       : Applications/System
Size        : 418761
License     : LGPLv2+ and GPLv3+ and GPLv2+ and Verbatim and Public domain
Signature   : RSA/SHA256, Sat 14 Mar 2015 04:15:54 AM EDT, Key ID 24c6a8a7f4a80eb5
Source RPM  : lm_sensors-3.3.4-11.el7.src.rpm
Build Date  : Thu 05 Mar 2015 10:48:12 PM EST
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.lm-sensors.org/
Summary     : Hardware monitoring tools
Description :
The lm_sensors package includes a collection of modules for general SMBus
access and hardware monitoring.
$

I then ran the sensors command to view the CPU temperature and fan speeds. The CPU and motherboard (MB) temperatures were high and the output showed 0 RPM for the chassis fan speed, indicating either there was no sensor monitoring its speed or it had stopped rotating.

$ sensors
atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:      +1.28 V  (min =  +0.85 V, max =  +1.60 V)
 +3.3 Voltage:      +3.36 V  (min =  +2.97 V, max =  +3.63 V)
 +5 Voltage:        +5.17 V  (min =  +4.50 V, max =  +5.50 V)
 +12 Voltage:      +12.41 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:     2518 RPM  (min =    0 RPM, max = 7200 RPM)
CHASSIS FAN Speed:    0 RPM  (min =  800 RPM, max = 7200 RPM)
CPU Temperature:    +79.5°C  (high = +60.0°C, crit = +95.0°C)
MB Temperature:     +61.0°C  (high = +45.0°C, crit = +95.0°C)

$

References:

  1. How to find fan speed in Linux for CPU and GPU
    By: Vivek Gite
    Last updated: February 11, 2021
    nixCraft

[/os/unix/linux/utilities] permanent link

Sat, Mar 09, 2019 4:25 pm

Installing and using cdparanoia to rip CDs on a CentOS Linux system

If you need to rip a CD from a command-line interface (CLI) on a CentOS Linux system, cdparanoia will allow you to do so. The cdparanoia CD ripper program will allow you to produce Waveform Audio File Format, i.e., .WAV, files from the tracks on a CD. You can use the yum package management software to install the software with by issuing the command yum install cdparanoia from the root account.

[ More Info ]

[/os/unix/linux/centos/music] permanent link

Fri, Mar 08, 2019 9:12 pm

Accessing the RPM Fusion repository from a CentOS system

Sometimes you may find that a software package that you would like to use on a CentOS Linux system is unavailable from the default software repositories, aka "repos." In such cases adding alternative repos, such as Extra Packages for Enterprise Linux (EPEL) or RPM Fusion may allow you to locate the desired package. E.g., the VLC media player is available in the RPM Fusion repository, but not the default ones nor in EPEL. RPM Fusion has two separate software repositories, one that contains free and open-source software (FOSS) and another named "nonfree". Packages in the "nonfree" repository still won't cost you anything, but there may be restrictions on the use of the software, e.g., you may be forbidden from using the software for commercial use. The RPM Fusion site defines the nonfree repo as being 'for redistributable software that is not Open Source Software (as defined by the Fedora Licensing Guidelines); this includes software with publicly available source-code that has "no commercial use"-like restrictions.'

[ More Info ]

[/os/unix/linux/centos] permanent link

Tue, Jan 01, 2019 10:42 pm

Creating new directories for a new year

I have a number of log directories where I store log files where the directory name is the current year. On the last day of the old year, I want to create new directories named for the upcoming year. I use the following Bash script to create those directories. Since I have several email log directories, I use a for loop to create a directory named after the upcoming year in each one.

#!/bin/bash
#
# Create a new directory corresponding to the upcoming year on December 31 of
# every year

newyear=$(date --date=tomorrow +%Y)
echo $newyear

# Apache logs

# Check on whether the directory for the current year exists and, if it doesn't,
# create it.
if [ ! -d /home/jdoe/www/logs/apache/"$newyear" ]; then
   mkdir /home/jdoe/www/logs/apache/"$newyear"
   chown apache /home/jdoe/www/logs/apache/"$newyear"
   chgrp apache /home/jdoe/www/logs/apache/"$newyear"
fi

# Email logs 

# Create an array holding the names of the 4 directories within which
# subdirectories will be created using the name of the new year. E.g.,
# /home/jdoe/www/logs/mail/sendmail_stats/2019

logdirs=( "dnsbl_count" "sendmail_stats" "smlogstats" "smreject"  )

for i in "${logdirs[@]}"
do :
   # Check on whether the directory for the current year exists and, if it 
   # doesn't, create it.
   if [ ! -d /home/jdoe/www/logs/mail/$i/"$newyear" ]; then
      mkdir /home/jdoe/www/logs/mail/$i/"$newyear"
      chown jdoe /home/jdoe/www/logs/mail/$i/"$newyear"
      chgrp jdoe /home/jdoe/www/logs/mail/$i/"$newyear"
   fi
done

I then have a crontab entry containing the following line that will result in the Bash script above, named end-of-year-dirs, being run at 7;00 AM on December 31 of each year.

0 7 31 DEC * /root/bin/end-of-year-dirs

Related articles:

  1. Loop through an array in Bash
  2. CRONTAB
  3. crontab -e
  4. smlogstats

[/os/unix/bash] permanent link

Fri, Jun 22, 2018 10:51 pm

Regular expression to find words/strings not ending with a character

If you wish to find strings at the end of a line that don't end with a particular character, you can use a bracket expresion with a caret character after the left square bracket in a regular expression.

Metacharacter Description
[^ ] Matches a single character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase letter from "a" to "z". Likewise, literal characters and ranges can be mixed.

[ More Info ]

[/os/unix/commands] permanent link

Sun, Feb 04, 2018 11:03 pm

Run a cronjob at the end of every year

At the end of every year, I need to create some new directories to hold log files with the directory name reflecting the new year on a CentOS Linux system. To create those directories on the last day of the year, December 31, I can use the cron utility found on Linux/Unix and OS X/MacOS systems to schedule a cronjob to run on the last day of the year. I can edit the crontab file that holds jobs to be run at a scheduled time or times by issuing the crontab command crontab -e, which will allow me to edit the file with the vi editor. If the vi editor is the default editor, which it likely is, but you are unfamiliar with that editor, you can change the editor for the current login session to the GNU nano text editor, which may be easier to use for someone unfamiliar with the vi text editor, by issuing the following command at the command line.

export EDITOR="/usr/bin/nano"

The value will be reset when you log off or you can reset it manually with the command below:

export EDITOR="/usr/bin/vi"

I can put the following line in the crontab file to run my script named end-of-year-dirs at 7:00 AM on December 31 of every year. When you add a new entry, be sure to hit the Enter key at the end of the line.

0 7 31 DEC * /home/jdoe/scripts/end-of-year-dirs

[ More Info ]

[/os/unix/commands] permanent link

Thu, Jan 18, 2018 11:55 pm

Viewing the login history for a user on a Linux or OS X system

If you want to see the IP addresses from which logins have occurred on a Linux or OS X system, you can use the last command. E.g.:

$ last ann
ann      tty2                          Thu Jan  5 20:23 - 20:27  (00:03)
ann      tty2                          Thu Jan  5 20:05 - 20:06  (00:00)
ann      tty2                          Thu Jan  5 20:01 - 20:02  (00:00)
ann      pts/0        8.25.222.2       Sun Oct 30 10:43 - 16:59  (06:16)
ann      pts/0        192.168.0.2      Tue Oct 11 12:02 - 12:03  (00:00)
ann      pts/0        192.168.0.2      Tue Oct 11 12:01 - 12:01  (00:00)
ann      pts/32       192.168.1.6      Sat Jun 11 20:03 - 20:38  (00:35)
ann      pts/32       192.168.1.6      Sat Jun 11 13:23 - 14:22  (00:58)
ann      pts/14       192.168.1.5      Sun Feb 14 17:05 - 18:28 (6+01:22)
ann      pts/6        8.23.51.9        Sun Nov  8 09:23 - 10:16  (00:52)
ann      pts/6        8.23.51.9        Sat Nov  7 08:54 - 16:42  (07:48)
ann      pts/7        8.23.51.9        Fri Nov  6 16:47 - 16:49  (00:02)
ann      pts/6        8.23.51.9        Fri Nov  6 15:48 - 23:33  (07:44)
ann      pts/0        :0               Thu Sep 10 15:25 - 12:38 (129+22:13)
ann      :0           :0               Thu Sep 10 15:24 - 12:38 (129+22:14)
ann      pts/5        :0               Sun Aug 23 11:08 - crash (18+04:03)
ann      pts/4        :0               Sat Aug 22 21:16 - crash (18+17:56)
ann      pts/3        :0               Sat Aug 22 09:14 - crash (19+05:58)
ann      :0           :0               Sat Aug 22 09:07 - crash (19+06:05)
ann      pts/2        192.168.1.6      Sun Jul 19 15:41 - 20:59 (1+05:18)
ann      pts/2        192.168.1.5      Mon Jun 22 21:28 - 20:17 (18+22:49)
ann      pts/2        192.168.1.6      Fri Feb  6 21:26 - 21:26  (00:00)
ann      pts/5        192.168.0.3      Wed Nov  5 21:07 - 22:15  (01:08)


wtmp begins Sun Oct  5 20:09:11 2014
$

[ More Info ]

[/os/unix/commands] permanent link

Fri, Jan 12, 2018 10:55 pm

Viewing only the files created today on a Linux system

I sometimes need to see only the files created or modified today in a directory. On a Linux system, you can pipe the output of the ls command into the grep command looking for just today's date in the input to the grep command as shown below:

$ ls -al --time-style=+%D ~/Documents/*.zip | grep $(date +%D)
-rw-r--r--. 1 joe joe   269338 01/12/18 /home/joe/Documents/gloves.zip
$

You can specify how the date is displayed with +format where format is a particular format in which you want the date displayed - see Formatting the output from the date command on a Linux system. If you use +%D, the date will be displayed as m/d/y, i.e., month/day/year, e.g. 01/12/18 for January 12, 2018. By then using the grep command to search for that value, you can limit the displayed files to only those created or modified today.

[ More Info ]

[/os/unix/commands] permanent link

Tue, Dec 12, 2017 11:25 pm

NetworkManager and nm-tool

If you wish to check the speed of network interfaces on a CentOS Linux system, if the nm-tool utility, is installed, then you can use it to determine the speed of the network ports.

$ nm-tool

NetworkManager Tool

State: disconnected

- Device: em1 ------------------------------------------------------------------
  Type:              Wired
  Driver:            bnx2
  State:             unmanaged
  Default:           no
  HW Address:        D4:AE:52:CD:0A:D4

  Capabilities:
    Carrier Detect:  yes
    Speed:           1000 Mb/s

  Wired Properties
    Carrier:         on


- Device: em2 ------------------------------------------------------------------
  Type:              Wired
  Driver:            bnx2
  State:             unmanaged
  Default:           no
  HW Address:        D4:AE:52:CD:0A:D5

  Capabilities:
    Carrier Detect:  yes

  Wired Properties
    Carrier:         off


$

If it is installed, the nm-tool program will likely be in /usr/bin . It is part of the NetworkManager package.

[ More Info ]

[/os/unix/linux/centos] permanent link

Sun, Dec 10, 2017 7:39 pm

Determining the version of CentOS on a system

If you are logged into a CentOS Linux system, there are a few ways you can determine the version of CentOS running on the system from a command-line interface (CLI), i.e., a shell prompt.

In the /etc directory, there should be a /etc/centos-release file containing information on the version of CentOS.

$ ls -l /etc/*elease
-rw-r--r--  1 root root  27 Mar 28  2017 /etc/centos-release
-rw-r--r--. 1 root root 152 Nov 25  2013 /etc/lsb-release
lrwxrwxrwx  1 root root  14 Apr 20  2017 /etc/redhat-release -> centos-release
lrwxrwxrwx  1 root root  14 Apr 20  2017 /etc/system-release -> centos-release
$ cat /etc/*elease
CentOS release 6.9 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphi
cs-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.9 (Final)
CentOS release 6.9 (Final)
$

To just see the version number, you can use one of the grep commands below.

$ grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release
6.9
$ grep -oE '[0-9]+\.[0-9]+' /etc/centos-release
6.9
$

[ More Info ]

[/os/unix/linux/centos] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo