You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2017/03/08 19:23:06 UTC

[2/3] incubator-trafodion git commit: optimize ps command in uninstall script

optimize ps command in uninstall script


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/079f1cea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/079f1cea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/079f1cea

Branch: refs/heads/release2.1
Commit: 079f1cea96866beb95417325a560952a74f7bb33
Parents: dc6e7bd
Author: Eason <hf...@gmail.com>
Authored: Tue Mar 7 11:21:23 2017 +0800
Committer: Eason <hf...@gmail.com>
Committed: Tue Mar 7 11:21:23 2017 +0800

----------------------------------------------------------------------
 install/python-installer/db_uninstall.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/079f1cea/install/python-installer/db_uninstall.py
----------------------------------------------------------------------
diff --git a/install/python-installer/db_uninstall.py b/install/python-installer/db_uninstall.py
index dc1fb43..d3990c7 100755
--- a/install/python-installer/db_uninstall.py
+++ b/install/python-installer/db_uninstall.py
@@ -101,8 +101,8 @@ def main():
     # remove trafodion userid and group on all trafodion nodes, together with folders
     for remote in remotes:
         info('Remove Trafodion on node [%s] ...' % remote.host)
-        remote.execute('ps -ef|grep ^%s|awk \'{print $2}\'|xargs sudo kill -9' % TRAF_USER, chkerr=False)
-        remote.execute('trafid=`getent passwd %s|awk -F: \'{print $3}\'`; if [[ -n $trafid ]]; then ps -ef|grep ^$trafid|awk \'{print $2}\'|xargs sudo kill -9; fi' % TRAF_USER, chkerr=False)
+        remote.execute('ps -f -u %s|awk \'{print $2}\'|xargs sudo kill -9' % TRAF_USER, chkerr=False)
+        remote.execute('trafid=`getent passwd %s|awk -F: \'{print $3}\'`; if [[ -n $trafid ]]; then ps -f -u $trafid|awk \'{print $2}\'|xargs sudo kill -9; fi' % TRAF_USER, chkerr=False)
         remote.execute('sudo -n /usr/sbin/userdel -rf %s' % TRAF_USER, chkerr=False)
         remote.execute('sudo -n /usr/sbin/groupdel %s' % TRAF_USER, chkerr=False)
         remote.execute('sudo -n rm -rf /etc/security/limits.d/%s.conf %s /tmp/hsperfdata_%s 2>/dev/null' % (TRAF_USER, TRAF_CFG_DIR, TRAF_USER), chkerr=False)