Skip to main content

Posts

Showing posts from February, 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
solusVM.
   >> 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
[root@Node]#

  If the outp

MySql database backup shell script

#!/bin/sh

# 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

do

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

done

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/diskspace.sh

2. Enter the following code in the script

=============================
#!/bin/sh

#Threshold is set to 70 here.
THRESHOLD=70
MAILTO=”youremailaddress”
TEMPFILE=/tmp/diskspace.temp
HOSTNAME=`hostname`

rm -f $TEMPFILE

#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 ]
then
echo “Warning!!! Disk Space usage on server $HOSTNAME is ${CDU}%” >> $TEMPFILE
fi

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

rm -f $TEMPFILE
==============================

3. Save the file and execute using crontab

crontab -e

0 1 * * 0  /bin/sh  /home/diskspace.sh