UnixServerAdmin

Server Administration & Management

How to Change File Attributes with Attrib from the Windows Command line (CLI) Prompt

Just run command prompt
Start -> Run -> CMD for XP, or
for Vista, Se7en & 10 Start -> type CMD in search box, right click and run as Admin,
type the following command:

attrib -H -S C:\path\to\your\file.doc /S /D

You can also use the asterisk character to define multiple extensions. For example:

attrib -H -S C:\raymond\*.* /S /D

This would remove the Hidden and System attribute of all files in the raymond folder on the C drive.

The /S and /D arguments are optional.

Just to point out, it’s probably not the best idea to use something like “C:\*.*” as this will unhide the whole drive including files which Windows has set as hidden or system by design.

R – This command will assign the “Read-Only” attribute to your selected files or folders.
H – This command will assign the “Hidden” attribute to your selected files or folders.
A – This command will prepare your selected files or folders for “Archiving.”
S – This command will change your selected files or folders by assigning the “System” attribute.
/S – This command will recurse down into all sub folders
/D – This command will unhide the folders themselves if they have the System or Hidden attribute set.

May 14, 2018 Posted by | Uncategorized | Leave a comment

How to limit CPU usage of any process in Linux

You can use cpulimit program that attempts to limit the cpu usage of a process. Limits are expressed in percentage and not in cpu time. cpulimit does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly.

Step-1 Install cpulimit

Type the following commands to install latest stable release:

# cd /tmp
# wget  http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz
# tar -zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /usr/local/sbin/
# rm -rf cpulimit*

Step-2 How do I use cpulimit?

To limit CPU usage of the process called firefox to 30%, enter:
# cpulimit -e firefox -l 30

To limit CPU usage of the process to 30% by using its PID, enter:
# cpulimit -p 1313 -l 30

To find out PID of the process use any of the following:
# ps aux | less
# ps aux | grep firefox
# pgrep -u vivek php-cgi
# pgrep lighttpd

You can also use absolute path name of the executable, enter:
# cpulimit -P /opt/firefox/firebox -l 30

Where,

-p : Process PID.
-e : Process name.
-l : percentage of CPU allowed from 0 to 100.
-P: absolute path name of the executable program file.

Root vs Normal User Account :–> cpulimit should run at least with the same user running the controlled process. But it is much better if you run cpulimit as root, in order to have a higher priority and a more precise control.

A Note About SMP (Multicore / MultiCpu) Systems :–> If your machine has one processor you can limit the percentage from 0% to 100%, which means that if you set for example 50%, your process cannot use more than 500 ms of cpu time for each second. But if your machine has four processors, percentage may vary from 0% to 400%, so setting the limit to 200% means to use no more than half of the available power. In any case, the percentage is the same of what you see when you run top.

July 13, 2015 Posted by | Tips & Tricks, Unix/Linux | , , | 1 Comment

How to read or view utmp, wtmp and btmp files in Linux

In Linux operating systems everything is logged some where. Most of the system logs are logged in to /var/log folder. This folder contains logs related to different services and applications. In this folder we have some files such as utmp, wtmp and btmp. These files contains all the details about login’s and logout’s which are from local as well as from remote systems and system status such as uptime etc.

utmp will give you complete picture of users logins at which terminals, logouts, system events and current status of the system, system boot time (used by uptime) etc.

wtmp gives historical data of utmp.

btmp records only failed login attempts.

# last ( Provide how logged in, when they logged in and when they logged out etc info on the screen.)

# last -f /var/log/wtmp (To open wtmp file and view its content use blow command)

# last -f /var/run/utmp (To see still logged in users view utmp file use last command)

# last -f /var/log/btmp (To view btmp file use same command)

August 10, 2014 Posted by | Tips & Tricks, Unix/Linux | , , , , | Leave a comment

Difference between /dev/null and /dev/zero files

/dev/zero and /dev/null are two pseudo files which are useful for creating empty files. Many people consider there is no difference or puzzled with what could be the difference between two files. There is considerable difference when writing data using these hardware files.

/dev/zero: This file is used to create a file with no data but with required size(A file with all zero’s). In other words this will create a data file with all zeros in the file which will give the size to a file. If you see the strace command on /dev/zero, it’s continuous zeros which it will write to a file. So we conclude that /dev/zero is a file use full for creating a file with some required size without any meaning to the data.

/dev/null: This is one more Pseudo file which is useful in many places like redirecting unwanted output/error etc to this file. This file acts as a black hole(Which eat up everything and do not show any output). So whenever you feed some data to this file, you can not retrieve the data which is fed to it. This file even useful for creating files with zero size.

July 30, 2014 Posted by | Tips & Tricks, Unix/Linux | , , , | Leave a comment

Why swap is double the size of the RAM in Linux

It has a meaning and for that we should know memory hierarchy. We have different levels of memory which is useful for processing your data. They are as follows.

  • Processor/CPU registers(Bits in size)
  • L1 Cache(kbs in size)
  • L2 Cache(MBs in size)
  • L3 cache(100s of MBs in size)
  • RAM(GB’s in size)

suppose take one application which is in running state. The application data is moved to RAM for faster accessing and some of its data is moved to L3 cache for processing frequently used data and we move more frequently used app data to L2 and then L1. And we move data which is right now processed by your processor/CPU to registers which is present in processor. If you observe the memory size will gradually decrease when you go up in the ladder more frequently used data is kept at higher levels and made it self available for processing. So if suppose you want to load a bigger program which can consume all the ram/L3/L2/L1 cache its better to move already running process to some location which we can access later to process it once again. But moving this data to HDD is not preferred as it is bit slow and other solution is to increase the RAM size which bit cost. So people came with a solution called SWAP partition which can solve both these limitations.

We create swap partition to cache all the data in registers, L1, L2, L3 caches and RAM.

Then why we create two times the RAM :–>  The reason behind it is that if you club all the above memory locations, the total size will be between 1.5 times to 2 times the RAM. This is the reason behind the thumb rule to create swap size 2 times the RAM

If I create swap size more than two times the RAM, What will happen –>  As we said earlier swap is used to move data from different memories and their total size is always 1.5 times to 2 times maximum so it’s of no use if you create swap size more than 2 times the RAM. In other words, all the space more than 2 times the RAM in swap is no use.

I have RAM size of 128GB and my RAM usage never fills up, do I have to create swap partition –> No, not at all required. As mention earlier swap is a temporary space to store all your memories data for future processing, if your RAM is free then there is no use of swap partition.

July 20, 2014 Posted by | Tips & Tricks, Unix/Linux | , , , | Leave a comment

Why we can create only up to 4 primary partitions

Actually in basic hard disk, we can create 4 partition(either primary or extended), we can create

  • 4 primary maximum or
  • 3 primary + 1 extended or
  • 2 primary + 1 extended or
  • 1 primary + 1 extended

not more then that? why and what is the reason?

The reason is because of a limitation of the MBR (Master Boot Record- the first sector of the hard disk.) The MBR is only 512bytes of size, it is needed to store the primary boot loader, and the partition table. Typically, the area reserved for partition table is only 64 bytes. And the partition table entry for one partition is 16 bytes. So, 16×4=64. The space is over. so we cant create more than this.

July 10, 2014 Posted by | Tips & Tricks, Unix/Linux | , , , | Leave a comment

Difference between NAS & SAN

S.No. NAS – Network Attached Storage SAN – Storage Area Network
1 It can be mapped as network drives to share on that server. It can be used as a ‘disk in disk’ and volume management utilities.
2 It provides storage and a file system. It provide Block based storage.
3 Protocols –> NFS, CIFS & SMB Protocols –> SCSI, Fibre Channel, iSCSI, ATA over Ethernet & HyperSCSI
4 For small & medium business For large organizations
5 Storage Capacity –> up to few TB Storage Capacity –> Many TB
6 Multiple NAS Devices Single SAN & Multiple high performance disk arrays
7 Specialized knowledge and training is not required to configure and maintain NAS. Specialized knowledge and training is required to configure and maintain SANs.
8 NAS & SAN are not mutually exclusive. A hybrid of SAN and NAS can offer file and block level protocols from the same system to support NAS and SAN.

June 30, 2014 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to find UUID of devices in Linux

This trick is for those who deal with many removable devices, with every device changing its name after you restart your systm. The solution is to mount devices by using their UUIDs (Universally Unique Identifier)

# blkid

/dev/sda1: UUID=”0bd49e6e-6692-410e-8408-5353905f5c42″ TYPE=”ext4″
/dev/sda2: UUID=”cea4d6d2-d624-4193-9576-67ec27b15796″ TYPE=”ext4″
/dev/sda3: UUID=”3b00985c-cf8d-4b87-be92-74186d0a2dcb” TYPE=”ext4″
/dev/sda5: UUID=”79b4e73d-d40d-428b-86a8-930506d86d8d” TYPE=”swap”

Which will show the UUIDs of devices, Now you can make an entry in the “/etc/fstab” file to avoid any problems.
This tip can also be applied in case of SAN storage, where every Logical Unit Number (LUN) needs to be mounted.

June 20, 2014 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to find Hardware information on Live (running) Servers & Systems

dmidecode is a tool for dumping a computer DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system hardware components, as well as other useful pieces of information such as serial numbers  and  BIOS  revision.  You can retrieve this information without having to probe for the actual hardware.  While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.

The  DMI  table  does not  only describe what the system is currently made of, it also can report the possible evolutions (such as the fastest supported CPU or the maximal amount of memory supported).

SMBIOS stands for System Management BIOS, while DMI stands for Desktop Management Interface. Both standards are  tightly related and developed by the DMTF (Desktop Management Task Force).

# yum install dmidecode

# dmidecode –type bios [About BIOS Details]

# dmidecode –type system [About System Information]

# dmidecode –type baseboard [About NIC & Storage Card Information]

# dmidecode –type chassis [About Chassis Information]

# dmidecode –type processor [About Processor Information]

# dmidecode –type memory [About Memory Information]

# dmidecode –type cache [About Cache Information]

# dmidecode –type connector [About USB Information]

# dmidecode –type slot [About Slot Information]

June 10, 2014 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to kill Multiple Processes In Linux

There are many cases where you want to kill multiple processes that match a certain pattern in their command line strings. For example, suppose you want to kill all processes that are running commands with keyword “javaxyz” in their arguments.

# ps aux | grep javaxyz

Here is a single command that will kill all processes at once that are matched with grep.

# kill -9 `ps aux | grep javaxyz | grep -v grep | awk ‘{print $2}’`

The command line inside a pair of backtick characters (i.e., ps aux …. ‘{print $2}’) will print out a list of process IDs that are matched with grep. The result is then used by the outer command kill. The “grep -v grep” is to exclude a self match (i.e., grep command itself) from a list of matched processes.

One caveat with this command is that when you are running it in a shell script, make sure to use bash, not sh.

If you are running the following script with sh: you will get “kill: Illegal number:” error. The command line inside a pair of backticks is returning a multi-line response, and it appears that sh is not able to handle it. But bash can. So the following script should be okay.

#!/bin/bash
kill -9 `ps aux | grep javaxyz | grep -v grep | awk ‘{print $2}’`

May 30, 2014 Posted by | Security, Tips & Tricks, Unix/Linux | , , , | Leave a comment

Commands Line Shortcuts

Here are following some tips to speed up our work.

# cmd1 ; cmd2

The above command will run cmd1 and then excute cmd2

# cmd1 && cmd2

This will execute cmd2, if cmd1 is successful.

# cmd1 || cmd2

The above sequence will run cmd2 if cmd1 is not successful.

May 20, 2014 Posted by | Tips & Tricks, Unix/Linux | , | Leave a comment

How to disable WhatsApp Blue Ticks for Read Messages

Recently, WhatsApp quietly introduced a new feature that lets users know that their messages have been read, with the double grey ticks appearing in front of the messages turning blue and now, just as quietly, the mobile messaging service is letting users of its Android app disable the feature with the rollout of WhatsApp version 2.11.444. This version is available for users on WhatsApp’s website for now, and will eventually be rolled out to all users.

Here’s how you can disable the blue coloured read receipts’ with the message timestamp on WhatsApp’s Android app:-

1. Make sure that your smartphone is running on Android 2.1 or a newer version.

2. Go to settings menu and enable ‘Download from Unknown Sources‘ in the Security tab

3. Go to the WhatsApp website and download the APK (application) file available under http://www.whatsapp.com/android/

4. Once the APK file is downloaded to your device, tap the ‘Install‘ option.

5. Now that WhatsApp has been updated, select Settings –> Account –> Privacy.

6. Under the Privacy tab, uncheck the Read Receipts option.

whatsapp

This feature however doesn’t apply to group messages and will let other participants know when you’ve read a message. Also, once you disable this feature, you won’t be able to view blue double-check marks when you send a message as well. 


The feature that enabled the users to see when their messages were read didn’t go down too well with the users and with this update, WhatsApp seems to be taking steps to please users who were not happy with the new feature.

May 10, 2014 Posted by | Security, Tips & Tricks | , , | Leave a comment

How to Fix rpmdb: unable to join the environment

This post will probably help you to fix an error occurring when you try to upgrade some package like this:

rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db3 – Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
warning: /root/webmin-1.360-1.noarch.rpm: V3 DSA signature: NOKEY, key ID 11f63c51
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm

How To Fix :-

# rm -f /var/lib/rpm/__db*     (Remove Old Lock Files running this command)

# rpm -vv –rebuilddb     (Now you have to rebuild RPM database)

# yum clean all

# yum update all

April 30, 2014 Posted by | Tips & Tricks, Unix/Linux | , , | 2 Comments

test ping.bat

: loop 0
ping -n 10 8.8.8.8

IF  %ERRORLEVEL%==0   ( goto loop 1 )

start c:1.mp3
ping -n 13 localhost > NUL

: loop 1
ping -n 5 192.168.1.1

IF  %ERRORLEVEL%==0   ( goto loop 0 )

start c:1.mp3
ping -n 13 localhost > NUL  ( goto loop 0 )

 

Note:- 8.8.8.8 to check Internet Connectivity & 192.168.1.1 to check Gateway Connectivity and 01.mp3 is siren ring.

April 20, 2014 Posted by | Tips & Tricks, Windows | , , | Leave a comment

tomcat_httpsd.conf_virtual-hosting-Secure for Java + PHP

We can run java and PHP based websites on same servers using SSL Certificate,
Here are six websites, inwhich four are based on Java and two are based on PHP

1. https://revenue.unixserveradmin.com – Java
2. https://revenue.unixserveradmin.com – Java
3. https://revenue.unixserveradmin.com – Java
4. https://revenue.unixserveradmin.com – Java
5. https://noc.unixserveradmin.com – PHP
6. https://online.unixserveradmin.com – PHP

# vim /etc/httpd/conf/httpd.conf

Line No. 201 to 212

#############################################################
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/worker.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkEnvVar SSL_CLIENT_V_START
JkMount /revenue* tomcat1
JkMount /mis* tomcat2
JkMount /sms* tomcat3
JkMount /sla* tomcat4

#############################################################
For Java Hosting
#############################################################

NameVirtualHost *:443

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
ServerName revenue.unixserveradmin.com
ServerAlias http://www.revenue.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /revenue/$1[L,PT]
JkMount /* tomcat1
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log commo
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
ServerName mis.unixserveradmin.com
ServerAlias http://www.mis.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /mis/$1[L,PT]
JkMount /* tomcat2
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
ServerName sms.unixserveradmin.com
ServerAlias http://www.sms.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat3
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
ServerName sla.unixserveradmin.com
ServerAlias http://www.sla.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat4
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

#############################################################
For PHP Hosting
#############################################################

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/noc/
ServerName noc.unixserveradmin.com
ServerAlias http://www.noc.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

<VirtualHost *:443>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/online/
ServerName online.unixserveradmin.com
ServerAlias http://www.online.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
SSLEngine on
SSLCertificateFile  /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile  /etc/pki/tls/private/localhost.key
SSLCertificateChainFile  /etc/pki/tls/certs/ca-bundle.crt
</VirtualHost>

#############################################################

April 10, 2014 Posted by | Apache, Tomcat | , | Leave a comment

tomcat_httpd.conf_virtual-hosting for Java + PHP

We can run java and PHP based websites on same servers, Here are six websites, in which four are based on Java and two are based on PHP

1. http://revenue.unixserveradmin.com – Java
2. http://revenue.unixserveradmin.com – Java
3. http://revenue.unixserveradmin.com – Java
4. http://revenue.unixserveradmin.com – Java
5. http://noc.unixserveradmin.com – PHP
6. http://online.unixserveradmin.com – PHP

# vim /etc/httpd/conf/httpd.conf

Line No. 201 to 212

#############################################################
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/worker.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkEnvVar SSL_CLIENT_V_START
JkMount /revenue* tomcat1
JkMount /mis* tomcat2
JkMount /sms* tomcat3
JkMount /sla* tomcat4

#############################################################
For Java Hosting
#############################################################

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName revenue.unixserveradmin.com
ServerAlias http://www.revenue.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /revenue/$1[L,PT]
JkMount /* tomcat1
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName mis.unixserveradmin.com
ServerAlias http://www.mis.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /mis/$1[L,PT]
JkMount /* tomcat2
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName sms.unixserveradmin.com
ServerAlias http://www.sms.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat3
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName sla.unixserveradmin.com
ServerAlias http://www.sla.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat4
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

#############################################################
For PHP Hosting
#############################################################

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/noc/
ServerName noc.unixserveradmin.com
ServerAlias http://www.noc.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/online/
ServerName online.unixserveradmin.com
ServerAlias http://www.online.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

#############################################################

March 30, 2014 Posted by | Apache, Tomcat | , | Leave a comment

worker.properties_virtual-hosting

##############################################################
# workers to contact, that’s what you have in your httpd.conf
# here are four different tomcat server, running on different ports
# tomcat1 for revenue portal
# tomcat2 for mis portal
# tomcat3 for sms portal
# tomcat for sla portal
##############################################################

worker.list=tomcat1, tomcat2, tomcat3, tomcat4

# setup tomcat1
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13

# setup tomcat2
worker.tomcat2.port=8109
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13

# setup tomcat3
worker.tomcat3.port=8209
worker.tomcat3.host=localhost
worker.tomcat3.type=ajp13

# setup tomcat4
worker.tomcat4.port=8309
worker.tomcat4.host=localhost
worker.tomcat4.type=ajp13
##############################################################

# worker.list –> Describe the workers that are available to Apache via a list
# ajp13 –> This type of worker represents a running Tomcat instance

March 20, 2014 Posted by | Apache, Tomcat | , | Leave a comment

disk_speed.sh

###########################################################
## disk_speed.sh ##
###########################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Following in msg.txt file ##
###########################################################
## Hi, ##
## The Disk Speed of Hard Drive in the server has been done. ##
## For Disk Speed Report, please check the attachment. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
###########################################################
#! /bin/bash

/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “THE Disk Speed Report of  Hard Drive in Server $(hostname) at $(date)” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo “Check Write Speed of Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “——————————–”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/dd if=/dev/zero of=test bs=1048576 count=2048  2>&1 | tee -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo “Check Read Speed of Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “——————————–”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/dd if=/dev/zero of=test bs=1048576 count=2048  2>&1 | tee -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

#/bin/echo “Remove test file from Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/rm -rvdf test

mutt -s “Disk Speed Report of Server $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt — unixserv@unixserveradmin.com   info@unixserveradmin.com < /REPORTS/msg.txt

March 10, 2014 Posted by | Shell Script | | 1 Comment

report-backup.sh

#############################################################
## report-backup.sh ##
#############################################################
## Script for Daily Backup Report of Servers ##
#############################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Folowing in msg.txt file ##
#############################################################
## Hi, ##
## The Daily Backup of All Servers have Done. ##
## The Daily Backup Report is attached with this mail. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
#############################################################
#!/bin/sh
set -x
set -v
standby=$1
BACKUPDIR=/datasrv/
BACKFILE1=`date ‘+%d-%b-%Y-‘`
BACKFILE2=`date –date=’yesterday’ ‘+%d-%b-%Y-‘`

/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “Daily Remote Backup Report of the Project on Today” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/usr/bin/du -hs /datasrv/*/*$BACKFILE1* >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt

/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “Daily Remote Backup Report of UPSRTC Project on Yesterday” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/usr/bin/du -hs /datasrv/*/*$BACKFILE2* >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt

mutt -s “Daily Remote Backup Report of the Project” -a /REPORTS/Backup.log_$(date +%d%m%y).txt — unixserv@unixserveradmin.com  info@unixserveradmin.com  < /REPORTS/msg.txt
###################################################################

February 20, 2014 Posted by | Shell Script | | Leave a comment

How to add Cluster or Node in Proxmox VE

There are three Clusters or Notes as Following :-

Cluster-1 or Node-1 :- 192.168.1.10
Cluster-2 or Node-2 :- 192.168.1.11
Cluster-3 or Node-3 :- 192.168.1.12

All settings can be done via command pvecm (Proxmox Virtual Environment cluster manager)

Step-1 :- Create the Master Cluster

Login via ssh to the first Proxmox VE node or cluster. Use a unique name for your Cluster, this name cannot be changed later.

node-1# pvecm create node-1

node-1# pvecm status (To check the state of cluster)

Step-2 :- Adding nodes to the Cluster

Login via ssh to the other Proxmox VE nodes. Please note, the node cannot hold any same VM´s. (If yes you will get conflicts with identical VMID´s – to workaround, use vzdump to backup and to restore to a different VMID after the cluster configuration).

node-2# pvecm add 192.168.1.10 (Add a node)

node-2# pvecm status (To check or display the state of cluster:)

Version: 6.2.0
Config Version: 2
Cluster Name: node-1
Cluster Id: 6639
Cluster Member: Yes
Cluster Generation: 8
Membership state: Cluster-Member
Nodes: 2
Expected votes: 2
Total votes: 2
Node votes: 1
Quorum: 2
Active subsystems: 5
Flags:
Ports Bound: 0
Node name: node-2
Node ID: 2
Multicast addresses: 239.192.25.9
Node addresses: 192.168.1.11

node-2# pvecm nodes (Display the nodes of cluster)

Node  Sts   Inc   Joined               Name
1   M    156   2013-09-05 10:39:09  node-1
2   M    156   2013-09-05 10:39:09  node-2
3   M    168   2013-09-05 11:24:12  node-3

node-1# pvecm delnode node-2 (Remove a cluster node)

February 10, 2014 Posted by | Proxmox, Virtualization | , , | 4 Comments