Use logger to write a messages to log files.

The basic syntax for logger is logger message. It does not require any options if you are just going to write a message to the logfile and you want to write to the default /var/log/messages at the notice level.

root# logger Added a new disk to a machine

You can see a message in /var/log/message file. Also you can run this command with option -s Log the message to standard error, as well as the system log.

root# logger -s Added a new disk to a machine

Rescan of a SCSI bus without rebooting the VM.

To issue a SCSI bus rescan you must know on which bus you’ve added the device. If you don’t know which bus and if there are mutliple buses on the system you can rescan each bus which will be somehow annoying but will not interrupt the system.
To initiate a SCSI bus rescan type:
root# echo "- - -" > /sys/class/scsi_host/hostX/scan
where X stands for the SCSI bus you want to scan, and then you can type the following:

root# lsscsi
root# fdisk -l
root# tail -f /var/log/message

Also C T L “Channel on HBA” “Tatget SCSI id” “LUN” can be used instead of “—“.

Flush caching BIND (DNS cache)

All you have to do is restart bind to clear its cache:

root# /etc/init.d/named restart

You can also use rndc command as follows flush out all cache:

root# rndc restart

or

root# rndc exec

BIND v9.3.0 and above will support flushing all of the records attached to a particular domain name with rndc flushname command.

root# rndc flushname domain.name.com

It is also possible to flush out BIND views. For example, lan and wan views can be flushed using the following command:

root# rndc flush lan
root# rndc flush wan

Recover the MySQL root password.

To recover the MySQL root Password, please follow these steps:

1. Stop the MySQL server process.

root# /etc/init.d/mysql stop

2. Start the MySQL process with the –skip-grant-tables option, so that it will not prompt for a password.

root# mysqld_safe --skip-grant-tables &

root@mad:/home/user# mysqld_safe –skip-grant-tables &
[1] 23126
root@mad:/home/user# 140729 11:09:49 mysqld_safe Logging to syslog.
140729 11:09:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

3. Connect to a MySQL as the root user.

root# mysql -u root

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 9
Server version: 5.5.38-0+wheezy1-log (Debian)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
mysql>

4. Set the new password for the MySQL root account.

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-PASSWORD") where user='root';
mysql> flush privileges;
mysql> quit

5. Exit and then stop and start or restart the MySQL server.

root# /etc/init.d/mysql restart

Enable local Linux users to access the NSS resource exported via NFS.

To enable the local Linux user to access the NSS resource exported via NFS, we need to create a user in eDirecotry and then enable this user in LUM in this example the user has an UID 1000, and then we can export the NSS via NFS to another server with user’s rights:

cat /etc/exsports
/media/nss/somedata/somedata server(fsid=1,rw,no_root_squash,sync,anonuid=1000,all_squash)