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 a script on the command line. The positional parameter names and meanings are shown in Table below. Positional Parameter Name Returns true (0) if: $0The … [Read more...] about Understanding Positional Parameters (Passing Parameters/Arguments to Shell script)
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 fi Here, The condition in the if statement often involves a numerical or string test comparison, but it can also be any command that returns a status of 0 when it … [Read more...] about Bash if loop examples (if then fi, if then elif fi, if then else fi)
Oracle Solaris Cluster : Understanding quorum votes and quorum devices (How to avoid Failure Fencing and Amnesia)
Need for Quorum Voting A quorum device is a shared storage device. A quorum server is shared by two or more nodes to contribute votes that are used to establish a quorum. Clusters operate only when a quorum of votes is available. Describing Quorum Votes and Quorum Devices The cluster membership subsystem of the Oracle Solaris Cluster software framework operates on a voting system as follows: Each node is assigned exactly one vote. Certain devices can be identified as quorum devices and … [Read more...] about Oracle Solaris Cluster : Understanding quorum votes and quorum devices (How to avoid Failure Fencing and Amnesia)
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 by xinetd , the super service receives the request and checks for any TCP wrappers access control rules. If access is … [Read more...] about Understanding /etc/xinetd.d directory under Linux
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 by xinetd , the super service receives the request and checks for any TCP wrappers access control rules. If access is … [Read more...] about Understanding /etc/xinetd.conf file in Linux
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 the system. If multiple versions of openjdk packages are installed on the system, alternatives command maybe be used to set … [Read more...] about How to work with multiple java versions under Linux
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 multicast address should be 1110 and the remaining 28 bits represent different goups. Some addresses are reserved and have been assigned to specified groups. For … [Read more...] about How to configure multicast on an IP address (interface)
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 … [Read more...] about CentOS / RHEL 7 : sysctl kernel parameter doesn’t take effect after reboot
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 distributions e.g. RHEL/OL and SuSE. Parameters that can be viewed/modified are those exposed via procfs filesystem /proc/sys. The … [Read more...] about How to query and modify kernel parameters using sysctl (Immediately and persistently) in CentOS / RHEL
Understanding “Holding a ZFS Snapshot” Feature
What is "Holding a ZFS Snapshot" feature Remote replication of ZFS datasets can result in different automatic snapshot policies on the two sides of a replication pair. For example, the sending side may want to keep five snapshots at one-minute intervals, whereas the receiving side may want to keep 10 snapshots at one-minute intervals. This can result in the older snapshots being destroyed inadvertently by zfs receive because they no longer exist on the sending side. The ZFS snapshot hold … [Read more...] about Understanding “Holding a ZFS Snapshot” Feature