Archive for category Scripts

Loadcheck script

================================================================= #!/bin/bash # # LoadCheck # Raj #——————————————————————– # #—–General-Configs———————————————— #general log name logn=$(date +”%m-%d-%H:%M.log”) #Path to the directory that will hold all logs logp=”/loadscripts/logs” #Path to file that is created for the email report loge=”/loadscripts/lastlog” #Script path – not needed – for later use scriptp= #—–Hard-Drive—————————————————— #Do we want to minitor hard drive usages? […]

Leave a comment

Usefull Scripts

script_to_chk_load_in_all_containers for x in $(vzlist -a | awk ‘{print $1}’) ; do  vzlist -a | grep $x  && vzctl exec $x w ;echo -e \n;done Determine the number of established and time_wait TCP connections on the server —————————————- netstat -an | grep tcp | egrep -i ‘established|time_wait’ | wc -l —————————————- How do you list […]

Leave a comment

cPanel Backup Script

#!/bin/bash ls /var/cpanel/users | grep ‘^a’ > a.txt cat ./a.txt | while read CPUSER; do echo “Now processing ${CPUSER} …” /scripts/pkgacct ${CPUSER} done The below script should help to force backups for particular domains on server .  Line  “ls /var/cpanel/users | grep ‘^a’ > a.txt ” copies account names starting with alphabet a to a […]

Leave a comment

Scripting

Replacing it with IT ========================= s—substitute command sed ‘s/it/IT/’ /root/test Please chek if you can do IT Replacing /usr/local/bin /common/bin ========================= sed ‘s/\/usr\/local\/bin/\/common\/bin/’  /root/secondone /common/bin sed ‘s:/usr/local/bin:/common/bin:’ /root/secondone /common/bin # sed ‘s_/usr/local/bin_/common/bin_’ /root/secondone /common/bin # sed ‘s|/usr/local/bin|/common/bin|’ /root/secondone /common/bin Deleting line conatining Good from file d–delet sed ‘/Good /d ‘ /root/thirdone Have a great day […]

Leave a comment