The execution of scripts is made versatile by the ability to run a script based on arguments supplied on the command line. In this way, the operation of the script varies depending on what arguments are given to the script. The shell automatically assigns special variable names, called positional parameters, to each argument supplied to […]
Archives for January 2018
Bash if loop examples (if then fi, if then elif fi, if then else fi)
The if Statement The if statement allows you to specify courses of action to be taken in a shell script, depending on the success or failure of some command. It is a conditional statement that allows a test before performing another statement. The syntax for the simplest form is: if [ condition ] then block_of_statements […]
Understanding /etc/xinetd.d directory under Linux
xinetd daemon The xinetd daemon is a TCP wrapped super service which controls access to a subset of popular network services including FTP, IMAP, and telnet. It also provides service-specific configuration options for access control, enhanced logging, binding, redirection, and resource utilization control. When a client host attempts to connect to a network service controlled […]
Understanding /etc/xinetd.conf file in Linux
xinetd daemon The xinetd daemon is a TCP wrapped super service which controls access to a subset of popular network services including FTP, IMAP, and telnet. It also provides service-specific configuration options for access control, enhanced logging, binding, redirection, and resource utilization control. When a client host attempts to connect to a network service controlled […]
How to work with multiple java versions under Linux
The Problem I installed a new version of the Java Runtime Environment but the “java -version” command does not show the new version. # java -version java version “1.7.0_65” OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) The Solution This problem could happen due to multiple installs of java on […]
How to configure multicast on an IP address (interface)
Multicast can be used to send IP packets to a group of interested receivers. Compared with broadcast, the packets are only sent to the members of a multicast group with the help of a multicast router. Multicast Addresses Class D addresses (224.0.0.0 – 239.255.255.255) are assigned to multicast. So the first 4 bits of a […]
CentOS / RHEL 7 : sysctl kernel parameter doesn’t take effect after reboot
The Problem sysctl parameter didn’t take effect after a reboot on RHEL 7 server. Parameter “net.ipv4.conf.all.forwarding” was disable before rebooting the server. # cat /proc/sys/net/ipv4/conf/all/forwarding 1 # sysctl net.ipv4.conf.all.forwarding=0 net.ipv4.conf.all.forwarding = 0 # cat /proc/sys/net/ipv4/conf/all/forwarding 0 #cat /etc/sysctl.conf|grep net.ipv4.conf.all.forwarding net.ipv4.conf.all.forwarding = 0 # shutdown -r now # cat /proc/sys/net/ipv4/conf/all/forwarding ### Gets enabled after reboot. 1 […]
How to query and modify kernel parameters using sysctl (Immediately and persistently) in CentOS / RHEL
The purpose of this post is to explain how to configure kernel parameters on Red Hat (RHEL/CentOS) and Oracle Linux (OL) systems using the sysctl utility. The sysctl utility (/sbin/sysctl) allows (privileged) users to query and modify kernel parameters during runtime. The utility is common to most Linux distributions, however, subtle differences may exist between […]
How to install and configure Samba in CentOS / RHEL
What is Samba To provide printer and file sharing, Microsoft Windows uses a facility known as SMB (Server Message Block). This same facility is sometimes known as NetBIOS or LanManager. Thanks to Andrew Tridgell and others, Linux systems provide support for SMB via a package known as Samba. Like SMB, Samba lets you: Share printers […]
CentOS / RHEL : How to add new swap partition
Question I have a new disk attached to the system. How can I create a new swap partition using this disk on the system? Solution For the purpose of this post, let’s assume that you do not have any swap configured on your system. /dev/sdc is the drive referenced with no partitions. Since we are […]