Category: Scripts

  • NTP offset monitoring bash script

  • Windows Pre migration checklist script

    @echo off echo. > %computername%.txt echo. >> %computername%.txt echo ======IP Configuration============================================================== >> %computername%.txt ipconfig /all >> %computername%.txt echo. >> %computername%.txt echo. >> %computername%.txt echo ======Net Start===================================================================== >> %computername%.txt echo. >> %computername%.txt echo. >> %computername%.txt net start >> %computername%.txt echo. >> %computername%.txt echo. >> %computername%.txt echo =====Netstat Output================================================================= >> %computername%.txt echo. >> %computername%.txt echo. >> %computername%.txt…

  • Remove Special Characters in a file using sed

    sed “s/[!@#\$%^’&* ()]//g”

  • Compare two files and show the differences only using shell command

    awk ‘BEGIN { while ( getline < "file1.txt" ) { arr[$0]++ } } { if (!( $0 in arr ) ) { print } }' file2.txt

  • Sample Ping Script

    It’s just a simple ping script. #!/bin/bash # Program name: test.sh date cat /root/listping.txt | while read output do ping -c 1 “$output” > /dev/null if [ $? -eq 0 ]; then echo “node $output is up” else echo “node $output is down” fi done

  • Add restricted user in linux manually.

    The code below will only allow the following commands. ping ssh telnet traceroute ifconfig route Add_Restricted_User.sh #!/bin/sh # Add restricted user in linux manually. # August 13, 2015 # Created by Rodel for a in `cat /opt/scripts/Add_Restricted_User/serverlist.txt`; do for b in `cat /opt/scripts/Add_Restricted_User/usernames.txt`; do echo $a $b; ssh $a “useradd -s /bin/rbash ‘$b’; echo -e…