How to Set or Configure Proxy in Linux and Windows System? – scmGalaxy

proxy-configuration-in-linux-and-windows
Setting the proxy configuration in Linux and Windows
If you use a proxy server or firewall, you may need to set the http_proxy environment variable in order to access some url from command-line.
Windows Command line
set http_proxy=http://your_proxy:your_port
set http_proxy=http://username:password@your_proxy:your_port
set https_proxy=https://your_proxy:your_port
set https_proxy=https://username:password@your_proxy:your_port
Windows GUI
1. Open the Control Panel and click the System icon.The System Properties dialog is displayed.
2. On the Advanced tab, click on Environment Variables. The Environment Variables dialog is displayed.
3. Click New in the System variables panel. The New Sytem Variable dialog is displayed.
4. Add http_proxy with the appropriate proxy information
Windows Registry
IE can set username and password proxies, so maybe setting it there and import does work
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyEnable /t REG_DWORD /d 1
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyServer /t REG_SZ /d name:port
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyUser /t REG_SZ /d username
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyPass /t REG_SZ /d password
netsh winhttp import proxy source=ie
Command to enable proxy usage:
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyEnable /t REG_DWORD /d 1 /f
Command to disable proxy usage:
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyEnable /t REG_DWORD /d 0 /f
Command to change the proxy address:
reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyServer /t REG_SZ /d proxyserveraddress:proxyport /f
Linux 
export http_proxy=http://your_proxy:your_port
export http_proxy=http://username:password@your_proxy:your_port
export https_proxy=https://your_proxy:your_port
export https_proxy=https://username:password@your_proxy:your_port
export https_proxy=https://%username%:%password%@your_proxy:your_port
FAQ
1. How to escape if password has a @ character
Ans – try %40 instead of @
2. What is the file name where it stroed the proxy in Ubantu
Ans – /etc/environment
3. How to set proxy inforamtin in Apt?
Ans – Adding following line to /etc/apt/apt.conf has solved the problem:
Acquire::http::proxy “http://10.1.3.1:8080/”;
If file does not exist, create it. Do not confuse it with apt.conf.d directory.
4. How to set proxy inforamtin in linux Profile?
5. Why manual export failed to affect apt-get with the proxy info?
Ans – The reason your manual export failed to affect apt-get is because sudo ignores that environment variable by default (i.e. it doesn’t pass it on to the command). For one-off runs, you could do sudo env http_proxy=http://10.1.3.1:8080 apt-get update. Otherwise, you could configure sudo to allow http_proxy to fall through.
Tagged : / / / / / / / / / / / / /

Java Installation Process in Linux – Complete guide

java-installation-in-linux

Download, Install and Configure JDK 8 & JRE 8

Platfrom – Debian & Ubuntu

#JRE8 - Package contains just the Java Runtime Environment 8
$ sudo apt-get install openjdk-8-jre

#JKD8 - Package contains just the Java Developement Environment 8
$ sudo apt-get install openjdk-8-jdk

Platfrom – Fedora, Oracle Linux, Red Hat Enterprise Linux, etc

#JRE8 - Package contains just the Java Runtime Environment 8
$ su -c “yum install java-1.8.0-openjdk”

#JKD8 - Package contains just the Java Developement Environment 8
$ su -c "yum install java-1.8.0-openjdk-devel"

$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm"

$ wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm > jdk-8u112-linux-x64.rpm

Platfrom – All platforms of Linux, Windows and Mac in Tar ball format

$ wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz

$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz"

$ wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

How to set JAVA in Linux System?

$ export JAVA_HOME=/opt/jdk1.8.0_144/
$ export PATH=/opt/jdk1.8.0_144/bin:$PATH;

Download, Install and Configure JDK 7 & JRE 7

Platfrom – Debian & Ubuntu

#JRE7 - Package contains just the Java Runtime Environment 7
$ sudo apt-get install openjdk-7-jre

#JKD7 - Package contains just the Java Developement Environment 7
$ sudo apt-get install openjdk-7-jdk

Platfrom – Fedora, Oracle Linux, Red Hat Enterprise Linux, etc

$ su -c “yum install java-1.7.0-openjdk”

$ su -c “yum install java-1.7.0-openjdk-devel”

Platfrom – All platforms of Linux, Windows and Mac in Tar ball format

wget –no-cookies –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com” “http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz”

wget –no-check-certificate –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz

curl -v -j -k -L -H “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm > jdk-7u79-linux-x64.rpm

JDK 6
Debian, Ubuntu, etc.
On the command line, type:
$ sudo apt-get install openjdk-6-jre
The openjdk-6-jre package contains just the Java Runtime Environment.
$ sudo apt-get install openjdk-6-jdk
If you want to develop Java programs then install the openjdk-6-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c “yum install java-1.6.0-openjdk”
The java-1.6.0-openjdk package contains just the Java Runtime Environment.
$ su -c “yum install java-1.6.0-openjdk-devel”
If you want to develop Java programs then install the java-1.6.0-openjdk-devel package.

 

 

Tagged : / / / / / / / / / / / / /

How to Install Docker in Linux?

install-docker-in-linux
How to Install Docker in Linux?
Note – You should install Docker using root or with sudo access.
Install Docker on Ubantu 
# apt-get update
# apt-get install -y docker.io
# service docker.io start
Install Docker on Redhar / Centos
# yum update
# yum install -y docker.io
# systemctl start docker.service
How to verify the version of docker?
# docker -v
# docker version
How to know docker running?
# service docker.io status (Ubantu)
# systemctl status docker.service (Redhat)
How to check details of Docker clients, deamon, containers, images, drivers, etc
# docker info
How to update Docker version?
==============================================
# wget -q0- https://get.docker.com/gpg | apt-key add –
# echo deb http://get.docker.com/ubantu docker main > /etc/apt/sources.list.d/docker.list
# apt-get update
# apt-get install lxc-docker
# docker version
Configuration post docker installation:
Adding Users to the Docker Group for non-root user
==============================================
# docker run -it ubuntu /bin/bash (as a non-root)
[ permission denied]
# cat /etc/group
# sudo gpasswd -a username docker
# cat /etc/group
# docker run -it ubuntu /bin/bash (as a non-root)
# logout
# login username
Tagged : / / / / / / / / / /

20 mpstat Commands Examples in Linux / UNIX | mpstat Commands Tutorial

If you are using SMP (Multiple CPU) system, use mpstat command to display the utilization of each CPU individually.
mpstat Report processors related statistics which includes Collecting and displays performance statistics for all logical processors in the system.. This display CPU statistics of individual CPU (or) Core.
How to install mpstat?
1. Ensure you are logged in as ‘root’
‘mpstat’ and ‘vmstat’ are apart of the ‘sysstat’ package and should be installed by default
2. Verify installation :
# rpm -qa | grep -i sysstat
3. Installation, if needed :
# rpm -ivh <name>
4. If you have connectivity to RHN or a Satellite Server:
# yum install sysstat
5. If you are using Ubantu:
# apt-get install sysstat

Usage:

1. Using mpstat command without any option, will display the Global Average Activities by All CPUs.
$ mpstat
2. Using mpstat with option ‘-P’ (Indicate Processor Number) and ‘ALL’, will display statistics about all CPUs one by one starting from 0. 0 will the first one.
$ mpstat -P ALL
3. To display the statistics for N number of iterations after n seconds interval with average of each cpu use the following command.
$ mpstat -P ALL 2 5
4. The option ‘I’ will print total number of interrupt statistics about per processor.
$ mpstat -I
5. Get all the above information in one command i.e. equivalent to “-u -I ALL -p ALL”.
$ mpstat -A
Reference
Tagged : / / / / / / / / /

20 iostat Commands Examples in Linux / UNIX | iostat Commands Tutorial

iostat command is a command that used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat create reports that can be used to change system configuration to better balance the input/output between physical disks.
You can use iostat command which report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. It can be use to find out your system’s average CPU utilization since the last reboot.
Reports Central Processing Unit (CPU) statistics, asynchronous input/output (AIO) and input/output statistics for the entire system, adapters, TTY devices, disks CD-ROMs, tapes and file systems.
Note:
iostat reports CPU, disk I/O, and NFS statistics.
vmstat reports virtual memory statistics.
mpstat reports processors statictics.
How to install iostat?
1. Ensure you are logged in as ‘root’
‘iostat’ and ‘vmstat’ are apart of the ‘sysstat’ package and should be installed by default
2. Verify installation :
# rpm -qa | grep -i sysstat
3. Installation, if needed :
# rpm -ivh <name>
4. If you have connectivity to RHN or a Satellite Server:
# yum install sysstat
5. If you are using Ubantu:
# apt-get install sysstat
1. iostat – Basic example, Iostat without any argument displays information about the CPU usage, and I/O statistics about all the partitions on the system as shown below.
$ iostat
2. iostat – Display only cpu statistics. iostat option -c, displays only the CPU usage statistics as shown below.
$ iostat -c
3. iostat – Display only disk I/O statistics. iostat option -d, displays only the disk I/O statistics as shown below.
$ iostat -d
4. iostat – Display only network statistics. iostat option -n, displays only the device and NFS statistics as shown below.
$ iostat -n
5. iostat – Display I/O data in MB/second. By default iostat, displays the device I/O statistics in Blocks. To change it to MB, use -m as shown below.

$ iostat -m

6. iostat – Display I/O statistics only for a device. By default iostat displays I/O data for all the disks available in the system. To view statistics for a specific device (For example, /dev/sda), use the option -p as shown below.
$ iostat -p sda
7. iostat – Display timestamp information, By default iostat displays only the current date. To display the current time, use the option -t as shown below.
$ $ iostat -t
8. iostat – Display Extended status, Use option -x, which will displays extended disk I/O statistics information as shown below.
$ iostat -x
9. To display extended information for a specific partition (For example, /dev/sda1), do the following.
$ iostat -x sda1
10. iostat – Execute Every x seconds (for y number of times). To execute iostat every 2 seconds (until you press Ctl-C), do the following.
$ iostat 2
11.To execute every 2 seconds for a total of 3 times, do the following.
$ iostat 2 3
12. iostat – Display LVM statistic (and version)
$ iostat -N
13. To display the version of iostat, use -V. This will really display the version information of sysstat, as iostat is part of sysstat package.
$ iostat -V
Reference
iostat use these files to create reports…
/proc/stat which contains system statistics
/proc/partitions which contains disk statistics (for pre 2.5 kernel that have been patched)
/proc/diskstats contains disks statistics (for post 2.5 kernel)
/sys which contains statistics for block devices (post 2.5 kernel)
Tagged : / / / / / / / / /

20 vmstat Commands Examples in Linux / UNIX | vmstat Commands Tutorials

vmstat-commands
vmstat – Report virtual memory statistics. vmstat is a tool that collects and reports data about your system’s memory, swap, and processor resource utilization in real time. It can be used to determine the root cause of performance and issues related to memory use.
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.
Note:
iostat reports CPU, disk I/O, and NFS statistics.
vmstat reports virtual memory statistics.
mpstat reports processors statictics.
How to install vmstat?
1. Ensure you are logged in as ‘root’
‘iostat’ and ‘vmstat’ are apart of the ‘sysstat’ package and should be installed by default
2. Verify installation :
# rpm -qa | grep -i sysstat
3. Installation, if needed :
# rpm -ivh <name>
4. If you have connectivity to RHN or a Satellite Server:
# yum install sysstat
5. If you are using Ubantu:
# apt-get install sysstat
Example
1. The significant of the columns are explained in man page of vmstat in details. Most important fields are free under memory and si, so under swap column.
[root@tecmint ~]# vmstat -a
procs ———–memory———- —swap– —–io—- –system– —–cpu—–
 r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 810420  97380  70628    0    0   115     4   89   79  1  6 90  3  0
Free – Amount of free/idle memory spaces.
si – Swaped in every second from disk in Kilo Bytes.
so – Swaped out every second to disk in Kilo Bytes.
2. Execute vmstat ‘X’ seconds and (‘N’number of times). With this command, vmstat execute every two seconds and stop automatically after executing six intervals.
# vmstat 2 6
3. Vmstat with timestamps. vmstat command with -t parameter shows timestamps with every line printed as shown below.
# vmstat -t 1 5
4. Statistics of Various Counter, vmstat command and -s switch displays summary of various event counters and memory statistics.
$ vmstat -s
5. Disks Statistics, vmstat with -d option display all disks statistics.
$ vmstat -d
6. Display Statistics in Megabytes, The vmstat displays in Megabytes with parameters -S and M(Uppercase & megabytes). By default vmstat displays statistics in kilobytes.
# vmstat -S M 1 5
7. vmstat – Display number of forks since last boot, This displays all the fork system calls made by the system since the last boot. This displays all fork, vfork, and clone system call counts.
# vmstat -f
8. vmstat – Display slab info, Use option -m, to display the slab info as shown below.
# vmstat -m
Reference
The output of vmstat is displayed in a number of columns. The following sections provide brief overviews of the data reported in each column.
Procs
The procs data reports the number of processing jobs waiting to run and allows you to determine if there are processes “blocking” your system from running smoothly.
The r column displays the total number of processes waiting for access to the processor. The b column displays the total number of processes in a “sleep” state.
These values are often 0.
r: The number of processes waiting for run time.
b: The number of processes in uninterruptible sleep.
Memory
The information displayed in the memory section provides the same data about memory usage as the command free -m.
The swapd or “swapped” column reports how much memory has been swapped out to a swap file or disk. The free column reports the amount of unallocated memory. The buff or “buffers” column reports the amount of allocated memory in use. The cache column reports the amount of allocated memory that could be swapped to disk or unallocated if the resources are needed for another task.
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
cache: the amount of memory used as cache.
inact: the amount of inactive memory. (-a option)
active: the amount of active memory. (-a option)
Swap
The swap section reports the rate that memory is sent to or retrieved from the swap system. By reporting “swapping” separately from total disk activity, vmstat allows you to determine how much disk activity is related to the swap system.
The si column reports the amount of memory that is moved from swap to “real” memory per second. The so column reports the amount of memory that is moved to swap from “real” memory per second.
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
I/O
The io section reports the amount of input and output activity per second in terms of blocks read and blocks written.
The bi column reports the number of blocks received, or “blocks in”, from a disk per second. The bo column reports the number of blocks sent, or “blocks out”, to a disk per second.
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).
System
The system section reports data that reflects the number of system operations per second.
The in column reports the number of system interrupts per second, including interrupts from system clock. The cs column reports the number of context switches that the system makes in order to process all tasks.
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
CPU
The cpu section reports on the use of the system’s CPU resources. The columns in this section always add to 100 and reflect “percentage of available time”.
The us column reports the amount of time that the processor spends on userland tasks, or all non-kernel processes. The sy column reports the amount of time that the processor spends on kernel related tasks. The id column reports the amount of time that the processor spends idle. The wa column reports the amount of time that the processor spends waiting for IO operations to complete before being able to continue processing tasks.
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
Field Description For Disk Mode
Reads
total: Total reads completed successfully
merged: grouped reads (resulting in one I/O)
sectors: Sectors read successfully
ms: milliseconds spent reading
Writes
total: Total writes completed successfully
merged: grouped writes (resulting in one I/O)
sectors: Sectors written successfully
ms: milliseconds spent writing
IO
cur: I/O in progress
s: seconds spent for I/O
Field Description For Disk Partition Mode
reads: Total number of reads issued to this partition
read sectors: Total read sectors for partition
writes : Total number of writes issued to this partition
requested writes: Total number of write requests made for partition
Field Description For Slab Mode
cache: Cache name
num: Number of currently active objects
total: Total number of available objects
size: Size of each object
pages: Number of pages with at least one active object
totpages: Total number of allocated pages
pslab: Number of pages per slab
Files
/proc/meminfo
/proc/stat
/proc/*/stat
Tagged : / / / / / / / / /

20 Xargs Commands Examples in Linux / UNIX | Xargs Commands Tutorials

xargs-commands

Under Development

The xargs command is extremely useful when we combine it with other commands.This tutorials explains the usage of xargs command using few simple examples.
1. Xargs Basic Example
The xargs command (by default) expects the input from stdin, and executes /bin/echo command over the input. When you execute xargs without any argument, or when you execute it without combining with any other commands. you get Welcome message
> xargs
Hi,
Welcome to TGS.Hi, Welcome to TGS.
After you type something, press ctrl+d, which will echo the string back to you on stdout as shown below.
2. Specify Delimiter Using -d option
Delimiters can be applied so that each character in the input is taken literally using -d option in xargs.In the following example, when you use the -d\n, it will preserve newline delimiter in the output, and display the output exactly as it was typed.
> xargs -d\n
Hi,
Welcome to TGS.
3. Limit Output Per Line Using -n Option
By default as explained earlier, xargs displays whatever comes to its stdin as shown below.
> echo a b c d e f| xargs
a b c d e f
> echo a b c d e f| xargs -n 3
a b c
d e f
In the following example, we used -n 3, which will display only 3 items per line in the xargs output.
4. Delete Files that has White-space in the Filename
> find . -name “*.c” -print0 | xargs -0 rm -rf
Example
# fild /usr/preserve –mtime +30 –exec rm –f {} \;
is equivalent to….
# find /usr/preserve –mtime +30 –print | xargs rm –f
# find /usr/preserve –size +1024 –print | xargs –n20 rm –f
Tagged : / / / / / / / / /

20 Mount and Unmount Filesystem / Partition commands in Linux / UNIX

partition-commands-in-linux-unix
Once you create a partition, you should use mount command to mount the partition into a mount point (a directory), to start using the filesystem.
You need to add the -t FILESYSTEMTYPE argument to the command, replacing FILESYSTEMTYPE with your filesystem type.valid filesystem types are:
auto – this is a special one. It will try to guess the fs type when you use this.
ext4 – this is probably the most common Linux fs type of the last few years
ext3 – this is the most common Linux fs type from a couple years back
ntfs – this is the most common Windows fs type or larger external hard drives
vfat – this is the most common fs type used for smaller external hard drives
The general mount command syntax to mount a device:
> mount -t type device destination_dir
Mount a CD-ROM
> mount -t iso9660 -o ro /dev/cdrom /mnt
In the above example, the option “-o ro” indicates that the cdrom should be mounted with read-only access. Also, make sure that the destination directory (in the above example, /mnt) exist before you execute the mount command.
View All Mounts
> mount
You can also use df command to view all the mount points.
Mount all the filesystem mentioned in /etc/fstab
The filesystems listed in /etc/fstab gets mounted during booting process. After booting, system administrator may unmount some of the partitions for various reasons. If you want all the filesystems to be mounted as specified in /etc/fstab, use -a option with mount as shown below:
> cat /etc/fstab
> mount -a
Access contents from new mount point
> mount -M /mydata /mnt/
Mount an iso image into a directory
> mount -t iso9660 -o loop pdf_collections.iso /mnt
Unmount

The same -a option can be used with umount to unmount all the filesystems mentioned in /etc/mtab

Example

# mount –t ext2 /dev/hda3 /oracle A empty directory must be made before mounting in linux
# unmounts /oracle
# unmounts /dev/hda3   Linux
# mount –a   This run when system boot
# unmont –a     This runs when shutdown sequence runs
# mount –t vfat /dev/hda1 /windows     Windows Partition – Linux
# mount configuration file – /etc/fstab
# default file system for mount in Linux is ext2
Reference
Tagged : / / / / / / / / / / / / /

How to Install and Configure Jira in Linux | Jira Tutorial

jira-installation-and-configuration-in-linux

Download JIRA package from 

https://www.atlassian.com/software/jira/download?b=j

Linux Installation:

wget https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-6.4.12-x64.bin

chmod atlassian-jira-6.4.12-x64.bin

Execute the ‘.bin’ file to start the console wizard

stop iptables

service jira start/stop

http://uvo1kievugg76unbcj9.vm.cld.sr:8080/

& follow the instructions

Reference

https://confluence.atlassian.com/jira/installing-jira-on-linux-191501165.html

Tagged : / / / / / / / / / / / / /

gsh – Run linux commands on many other linux server at once

gsh-run-linux-commands

gsh – Run linux commands on many other linux server at once

Group Shell (also called gsh) is a remote shell multiplexor. It lets you control many remote shells at once in a single shell. Unlike other commands dispatchers, it is interactive, so shells spawned on the remote hosts are persistent.

GSH is a pluggable version of DSH (Distributed Shell) written in Python. Both a module and a command-line tool for running a shell command over multiple machines are included. GSH can be extended by adding new host loaders as well as hooking into various stages of the runtime.

It requires only a SSH server on the remote hosts, or some other way to open a remote shell.
gsh allows you to run commands on multiple hosts by adding tags to the gsh command.

e.g > gsh tag “remote command”

Important things to remember:
/etc/ghosts contains a list of all the servers and tags. gsh is a lot more fun once you’ve set up ssh keys to your servers

gsh [OPTIONS] SYSTEMS CMD…
SYSTEMS is a combination of ghost macros. See ghosts(1).

CMD is the command to run
-h, –help Display full help
-d, –debug Turn on exeuction debugging reports
-h, –no-host-prefix Does not prefix output lines with the host name
-s, –show-commands Displays the command before the output report
-n, –open-stdin Leaves stdin open when running (scary!)
-l, –user USER SSH’s to the host as user USER
-r, –run-locally Run commands locally (replaces $host with host)
-o, –self-remote Run locally instead of over SSH for local host
-V, –version Report the version and exit

You set up a /etc/ghosts file containing your servers in groups such as web, db, RHEL4, x86_64, or whatever (man ghosts) then you use that group when you call gsh.

How to run the gsh?
> gsh linux “cat /etc/redhat-release; uname -r”

You can also combine or split ghost groups, using cpanel+vps or web-RHEL4, for example.

Here’s an example /etc/ghosts file:
# Machines
 #
 # hostname OS-Version Hardware OS cp security
 linuxbrigade.com debian6 baremetal linux plesk iptables
 linuxbrigade.com centos5 vps linux cpanel csfcluster
 linuxbrigade.com debian7 baremetal linux plesk iptables
 linuxbrigade.com centos6 vps linux cpanel csfcluster
 linuxbrigade.com centos6 vps linux cpanel csfcluster
 linuxbrigade.com centos6 vps linux nocp denyhosts
 linuxbrigade.com debian6 baremetal linux plesk iptables
 linuxbrigade.com centos6 baremetal linux cpanel csf
 linuxbrigade.com centos5 vps linux cpanel csf

Reference url

http://www.linuxbrigade.com/run-the-same-command-on-many-linux-servers-at-once/
http://linux.die.net/man/1/gsh
https://github.com/gmjosack/gsh
http://outflux.net/unix/software/gsh/
http://outflux.net/unix/software/gsh/gsh.html

Tagged : / / / / / / / / / /