Tag: script

  • Mysql db backup batch script for windows

    This is an example of very simple mysql database backup batch script for windows machines: @echo off REM “MySql Backup Initiated” REM “Mysql username/password” SET mysqlUsername=”root” SET mysqlPassword=”root” REM “Creating folder with date stamp” set datestamp=%date:~-4,4%%date:~-10,2%%date:~7,2% mkdir D:\backup\dbBackup\mysql_%datestamp% SET backupDir=”D:\backup\dbBackup\mysql_%datestamp%” REM “Database backup Started” SET mysqlCmdDir=”c:\Program Files\MySQL\MySQL Server 5.5\bin” cd %mysqlCmdDir% mysqldump -uroot -proot exampledb…

  • How to get IP address in shell script

    There is many ways to get IP address some popular and easier are mentioned below- In Example 2 we may get IP from particular interface. Example 1: !/bin/bash IPADDRESS=`ifconfig | awk -F’:’ ‘/inet addr/&&!/127.0.0.1/{split($2,_,” “);print _[1]}’` echo “Machine IP address is: $IPADDRESS” Example 2: !/bin/bash IPADDRESS=`ifconfig eth0 | grep ‘inet addr:’ | cut -d: -f2…