This script is created for my brother as he wanted to print the only values which are different from each other in both files but only in 3rd Column. In this, the first column contains a unique id. #!/bin/bash awk -F “,” ‘{print $1}’ yash.csv > yashids.csv for n in `cat yashids.csv` do ID=`grep $n net.csv | awk -F “,” ‘{print $3}’` ID2=`grep $n yash.csv | awk -F “,” ‘{print…
vim /root/memory_cache_flush.sh #!/bin/bash freem=$(free -m|grep Mem|awk ‘{print $4}’) # change 1024 to other value, for e.g you want set limit to 2GB then change it to 2048 if [ “$freem” -lt 1024 ] then echo 1 > /proc/sys/vm/drop_caches freenew=$(free -m|grep Mem|awk ‘{print $4}’) echo “Server had only $freem MB free RAM, After memory cache is flushed, free RAM is $freenew MB” | mail -s “Memory cache flushed on server server.the-d2.com…
#!/bin/bash # Use this script for Ubuntu only. # By default this script will install 64bit Teamviewer echo “============================================” echo -e “\e[1;32m REMOVING PREVIOUS TEAMVIEWER IF ANY ………… \e[0m” echo “============================================” sudo apt-get remove teamviewer -y sudo apt autoremove -y sudo apt-get remove teamviewer:i386 -y sudo dpkg -r teamviewer:i386 sudo dpkg –purge teamviewer sudo dpkg –purge teamviewer:i386 sudo apt autoremove -y rm -fr /tmp/teamviewer* cd /tmp/ ; wget http://download.teamviewer.com/download/version_12x/teamviewer_amd64.deb sudo…
Create a file check_disk.sh Paste below code the execute as ” bash check_disk.sh ” #!/bin/bash for i in G M do du -ah / 2> /dev/null | grep [0-9]$i | sort -nr -k 1 | awk ‘$1 ~ “(M|G)$” {print $0}’ done It may take some time depending on your number of files on server.
vim purge-varnish-cache.php Paste below code <?php $output = shell_exec(‘curl -X PURGE “https://the-d2.com” > /dev/null 2>&1’); echo “Varnish Cache Cleared :)”; ?> Place the php file somewhere that you can call it from browser, e.g the-d2.com/purge-varnish-cache.php
Find them find / -name ‘core.*[[:digit:]]’ -exec du -sch {} \; Delete them find / -name ‘core.*[[:digit:]]’ | xargs rm -f Cron 0 * * * * find / -name ‘core.*[[:digit:]]’ | xargs rm -f Issue:- Huge size of core.xxxx files