Saturday, April 11, 2026

Linux Ssh Commands and scripts

 
-bash-4.4$ read -p "Enter server hostname: " server; ssh -tq ${server} "(echo 'oracle db osusername: '; ps -ef | grep pmon | grep 'ora_pmon_'| grep -v grep | awk '{print \$1}';echo 'oracle pmon process: ';ps -ef | grep pmon | grep 'ora_pmon_' | grep -v grep | awk '{print \$NF}')"
Enter server hostname: hostname
oracle db osusername:
oracle
oracle pmon process:
ora_pmon_hostname

correct way to use awk in ssh :
-bash-4.4$ ssh -tq hostname "(ps -ef | grep pmon | grep 'ora_pmon_'| grep -v grep | awk '{print \$1}')"
oracle

-bash-4.4$ ssh -tq hostname "(ps -ef | grep pmon | grep 'ora_pmon_'| grep -v grep | awk '{print \$NF}')"
ora_pmon_hostname

=TEXTJOIN(" ", TRUE, "alter user system identified by """, D2:D50 & """)


No comments:

Post a Comment

Enable OpenSSH on Windows 11

Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...