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

opatchauto

# Log in as root su - root # Execute opatchauto against the unzipped patch directory /u01/app/19.0.0/ grid /OPatch/opatchauto apply /tmp/pat...