Category: Linux
Shell script to restart MySQL server if it is killed or not working due to ANY cause
#!/bin/bash # Shell script to restart MySQL server if it is killed or not working # due to ANY cause. # When script detects mysql is not running (it basically sends ping request # to MySQL) it try to start using /etc/init.d/mysql script; and it sends an # email to user indicating the status. # […]
Diskusage in catalogs using du
Oneliner to determine recursive diskusage in catalogs ls -lR|du -sh *
Shell script utility to read a file line by line
#!/bin/bash # # Shell script utility to read a file line line version 2 # This is simpler version of readline script # This script also demonstrate how to process data file # line by line and then separate line in fields, so that # you can process it according to your need. # # […]
Reverse text content in file
#!/bin/bash # Bash shell script to reverse text file contain i.e. concatenate files and # print on the standard output in reverse. This script also demonstrate how # to use arrays under bash shell script. FILE=”$1″ if [ $# -eq 0 ]; then echo “$(basename $0) – file-name” exit 1 fi textArray[0]=”” # hold text […]