Shell Scripts

#!/bin/bash while : do clear echo “———————————————-“ echo ” * * * * * * * Main Menu * * * * * * * * * * “ echo “———————————————-“ echo “[1] Change password” echo “[2] See disk space” echo “[3] Login to other …

#!/bin/bash echo “=====================”; echo ” Apache Total Memory Utilization” echo “=====================”; TAPACHE=`ps -ylC apache2 | awk ‘{x += $8;y += 1} END {print x/1024;}’` echo “$TAPACHE”; echo “=====================”; echo “Apache Memory Usage by each process:” echo “=====================”; APACHEMEM=`ps -ylC apache2 | awk ‘{x += $8;y …

This shell script calculate Apache Max client. #!/bin/bash echo “=====================”; echo ” Apache Total Memory Utilization” echo “=====================”; TAPACHE=`ps -ylC httpd | awk ‘{x += $8;y += 1} END {print x/1024;}’` echo “$TAPACHE”; echo “=====================”; echo “Apache Memory Usage by each process:” echo “=====================”; APACHEMEM=`ps …

How to debug a shell script To debug shell script you can use -x option from command line: # bash -x script-name OR #bash -xv script-name Example: sh -x example.sh sh -x test.sh You can use -x option with shebang line and can run entire …

Install FFMPEG and FFMPEG-PHP On CentOs & RedHat   We can install ffmpeg with yum repository but before we have to create new repo with name dag.repo   Create new repository with name dag.repo #vi /etc/yum.repos.d/dag.repo Add DAG GPG key   Update yum # yum …

Shell Script for incremental data backup Here I have written shell script incremental data backup with rsync. You can schedule cron job for daily incremental backup. # !/bin/bash  # Create backup directory if doesn’t exitst  #backup Desitnation Directory  BACKUPD=/backup  [ ! -d $BACKUPD ] && …