Skip to main content


Showing posts from 2015

Enable TUN/TAP and PPD in VM on open VZ

How to enable TUN/TAP and PPD in VM on open VZ ========================================
Please use the below steps to Enable TUN/TAP and PPD in VM on open VZ.

   1.Check the Node is enabled with tun/tap by entering the same from
   >> Go to list node >> edit node >> check "Allow clients to set TUN/TAP"
and "Allow clients to set PPP".

   2.How to enable TUN/TAP in OpenVZ?
STEP 1: Login to Node via SSH
STEP 2: Run the below pasted command to find out tun module is already loaded
or not

[root@Node]# lsmod | grep tun

  If the outp

MySql database backup shell script


# Setting date to name the backupfile with todays date date=`/bin/date "+%Y%m%d"`

# creating backup folder

/bin/mkdir -p /mysqlbkp/dbbackup_$date
DBS="$(mysql -Bse 'show databases')"

for db in $DBS


/usr/bin/mysqldump --routines $db > /mysqlbkp/dbbackup_$date/$db.sql


The backups will be generated in the location /mysqlbkp under the folder dbbackup_todays date.

Simple Shell Script for Disk Space Notification

1. Create a file /home/

2. Enter the following code in the script


#Threshold is set to 70 here.


#Calculate the Current Disk Usage with the below command.
CDU=$(df -h | tail -1 | awk ‘{print $5}’ | sed ‘s/%//’)

#Compare the current value with the threshold one.
if [ $(expr $CDU ">=" $THRESHOLD) -ne 0 ]
echo “Warning!!! Disk Space usage on server $HOSTNAME is ${CDU}%” >> $TEMPFILE

#Send an email if /tmp/diskspace.temp is present.
if [ -e $TEMPFILE ]
mail -s “Disk Space Notification” $MAILTO < $TEMPFILE


3. Save the file and execute using crontab

crontab -e

0 1 * * 0  /bin/sh  /home/

Process uptime - Linux

How to find the uptime of a Linux Process

1. Login to the server as root.

2. Run the below provided command

ps -eo pid,comm,lstart,etime,time,args | grep process-name


PID - Process ID .ie. the ID of the process that we are searching.

comm - Display the process name.

lstart - The time at which the process is started.

etime - The time elapsed once the process is started.

args - command with options and arguments.

process-name - The process for which we need to check uptime.

For eg :

:~$ ps -eo pid,comm,lstart,etime,time,args | grep cron
  937 cron            Fri Jan 30 09:42:17 2015       37:36 00:00:00 cron

The cron deamon is running in the server from 9:42 AM and is alive for 37 minutes till now. Check the etime field. (37:36)
This is how we can detect the uptime of a process in Linux.

Added on Jan 30 10.26 AM