##Google Analz## ##Microsoft## ##Googel## Swanand: 2015

Friday 10 April 2015

Email alert on disk space outage in linux/vicidial/goautodial server

starbitinvest
Email alert when hard disk is full in linux



           Most of times i will be facing mysql database crash error due to my hard disk out of space , Because of huge call Recordings in vicidial or goautodial server.

so i decided to have a alert via email when my harddisk space reaches 90% .
Below is the script i used to get email alert when my hard disk reaches 90% full
thanks to : http://www.cyberciti.biz/

*******************************
Step 1: Create a bash script file
*******************************
vi /usr/share/diskspacealert.sh

*******************************
Step 2 : paste the below script
*******************************

#!/bin/sh
# refered http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
# enter your mailed below for email alert
ADMIN="admin123@gmail.com"
# set alert level 90% is default
ALERT=90
df -HP | grep -vE '^Filesystem|tmpfs|cdrom' |
  while read partition size used free perc mnt ;
  do
    usep=$(echo $perc | tr -d '%' )
    if [ $usep -ge $ALERT ]; then
      echo "Running out of space \"$partition ($usep%)\" on $(hostname) as
  on $(date)" |
       mail -s "Alert: Almost out of disk space - $usep%" $ADMIN
    fi
  done


Note *** change the admin123@gmail.com  to your mail id to which you want email alert

*******************************
Step 3 : make the script executable
*******************************
chmod 755 /usr/share/diskspacealert.sh


*******************************
Step 4 : scheduling the scrip to run every day 
*******************************
Setpup a cronjob daily morning or whatever time you wish check the below link for cronjob turorial
http://swanand18.blogspot.in/2015/04/cronjob-tutorial-how-to-cronjob.html

type  crontab -e  in the linux shell

then add the below line

0 10 * * * /usr/share/diskspacealert.sh

this will run the script every day 10 am

Note : ***
you must have installed and configured 
Sendmail  
mailx

cronjob tutorial - how to cronjob

he Basic Format of a crontab/cronjob consists of 6 fields , placed on a single line and separated by spaces , formatted as follows





minute hour day month day-of-week command-line-to-execute


The acceptable values for each of the 6 fields are:
FieldRange of values
minute0-59
hour0-23
day1-31
month1-12
day-of-week0-7 (where both 0 and 7 mean Sun, 1 = Mon, 2 = Tue, etc)
command-line-to-executethe command to run along with the parameters to that command if any

The Fields have to be in that exact order ,with no empty or missing fields and everything must be placed on a single line

***********************************
Minute
***********************************
"Minute" is a number from 0 to 59. "Hour" is a number from 0 to 23. They represent the time of the day in a 24-hour day format, so for example, if you want a certain command to run at 5.30 am, you will have to code it as:

30 5
If you want something run at 8 pm, it has to be coded as

0 20

since 2000 hours is 8 pm in the 24-hour time format.
***********************************
Day and Month
***********************************
"Day" and "month" refer to dates. "Day" takes a value between 1 and 31, and "month", as you may have already guessed, can take any value between 1 and 12. So if you want a command run on 5th January at 9.15 am, your schedule should begin with the following:

15 9 5 1

***********************************
Day of week
***********************************

"Day-of-week" means basically which day you want your command to run. If you want your command to run on Sundays, use either 0 or 7 here. If you want it on Monday, use 1. (Note: if you are getting worried at this point how to combine all the various fields, some of which seem to contradict the other, don't worry. We're getting to that.)

The trick to scheduling things, say, once a day, or once in 2 hours or the like, is to use a wildcard character. A wildcard character is like the Joker in a pack of playing cards, that is, it is something that can represent any card in the pack. In a crontab file, the wildcard character "*" (the asterisk, without the quotes), represents every possible value for the field.
If you want a particular program to run, say, once every day at 10.45 am, the time portion of the cron schedule should read:

45 10 * * *
Here's how to read the above line.

The first two fields "45 10" means that you want it to run at 10.45. The next field, the day field, is set to * (the asterisk character) to show that we're talking about 10.45 every day, not just the 1st of the month (which would be "1") or the 30th of the month ("30") or some other number.
The month field is set to the asterisk as well. If we set some number in the month field, say "2", we will be saying that we only want the command to run at 10.45 in the month of February ("2"). Since that's not what we need, we put the asterisk to mean every month.
Similarly, the day-of-week field is set to the asterisk, because we want the command to run whether it's Sunday ("0") or Monday ("1") or whatever day.

More Examples: An Hourly Schedule

Now if you want a job to run every hour on the hour, you will have to set the time component of the crontab line as follows:
0 * * * *
Can you see why? The "0" means at the top of the hour, that is, when the minute readout on a digital clock shows "00". The asterisk in the hour field means every single hour. In other words, every hour, on the hour.

Alternate Hour or 3 Hourly Schedule

If you want something to run once every two hours, you will have to use the slash, "/", character in your field. The slash character is the "step" character. In the case of a two hourly schedule, your time component of your cron file will read:
0 */2 * * *
The second field, "*/2", means every alternate hour.
Similarly, if you want something to run every 3 hours, you can change that field to "*/3", and so on.

Other Examples

If you want a particular command to run only at 8.00am on the 1st and 20th of every month, you should code the time as:
0 8 1,20 * *
The comma, ",", means "and". If you are confused by the above line, remember that spaces are the field separators, not commas.
What does the following schedule mean?
2 3 4,5 6 7
Decoded, the above line says at 3:02 am on the 4th and 5th of June (6) and on every Sunday (7), run your program.
There are other possibilities in the time fields, and I won't go through all of them, since you already know enough to be able to construct whatever schedule you need.


How to specify the command line

The command-line-to-execute portion of the schedule is basically the command you want run at the specified time. For example, if you have a Perl script called "whatever.pl" that you want run every day at 11.30 am, your crontab schedule might read as follows:
30 11 * * * /your/directory/whatever.pl

Thanks to : http://www.thesitewizard.com/general/set-cron-job.shtml

Friday 13 February 2015

How to Install MIUI 6 on Xiaomi Redmi Note 4G



In this tutorial we will show you how to manually install the update on your Redmi Note 4G.
Important Note: This update will work only on the 4G variant of Redmi Note, please do not try on the 3G variant. Remember to take a backup of your files before updating (update will not wipe your storage).

Steps to Update:

1. First download the MIUI 6 update for Redmi Note 4G from here. (official update).
2. Copy this zip file into your phone by connecting to PC via USB cable. You can copy the file into downloaded_ROM folder (or any other folder of your choice).
3. Now open the Updater app on the device and click on menu button. You will see the option “Select update package”

4. Now browse for the zip file which we copied into the device in step 2.
5. Now click Update now button and the process will start.
The update process takes around 10 minutes or so. Be patient till the time the update is installed. The phone will automatically reboot and you will have MIUI 6 on Redmi Note 4G.
Here are some of the screenshots of MIUI 6 on Redmi Note

   
     
.
After the update, the UI looks smoother and more responsive and the Android version is now at 4.4.4 KitKat. So if you have Redmi Note 4G, you can now try this method and update your device.

How To Install Google Play Store and other GApps on Xiaomi Mi3 or Mi4 on MIUI 6


How To Install Google Play Store and other GApps on Xiaomi Mi3 or Mi4 on MIUI 6



If you are facing any trouble installing Google Applications like Play Store, Gmail and rest of the applications on your Xiaomi Mi3 or Xiaomi Mi4. This is because the developers ROM is available for Chinese WCDMA users only and that ROM doesn’t support Google Play or any of the application by Google. If you are using MIUI 6 then you have probably faced this kind of problem with your device, frequent app. crashing and inability to access play store.

Since most of the people are facing this kind of issue with MIUI 6 China WCDMA, we have prepared a guide for the same. This is a working method I am currently using play store via this method.

Installing Google PlayStore on Xiaomi Mi3 or Xiaomi Mi4

  • Navigate to the market application pre-installed with MIUI 6, then search for “Google” you will seeGoogle Installer then Install that application.
  • Once Google Installer is successfully installed on your device launch the application.

Now Search for Google Play Store and Tap on Install, then you will observe a popup displaying Google Play Store requires Google Service Framework to work. Tap OK and install Google Service Framework.
Then you will see 4-5 applications including Google Service Framework, install all those applications and proceed further.



  • After installing Google Service Framework and rest of the apps, install Play Store and log in with your GMail account or sign up for a new account.
  • You won’t face any issue from now onwards, If you have migrated from MIUI 5 to MIUI 6 then you will probably facing app crashing problem but don’t panic you can resolve app crashing on Mi3 as well as Mi4 by Wiping Cache and Data in recovery and then installing GApps using the above mentioned procedure.
I hope the above procedure helped you, in case you are stuck do mention in comments we will try to resolve for you.

Featured post

Vicidial With WebRTC

Vicidial With WebRTC VICIDial is well known open source call center software. It has been in use by many small to large scaled con...