Oct-20-2018, 04:14 PM
(This post was last modified: Oct-20-2018, 04:14 PM by alinaveed786.)
Thanks. Seems like now unzip is not working and hence chdir too.
It works only when dir /u03/21171382 and /u03/21463894 exist
It works only when dir /u03/21171382 and /u03/21463894 exist
#!/usr/local/bin/python3.6 import subprocess from plumbum import local, cmd patch = [21171382,21463894] ORACLE_HOME = local.env['ORACLE_HOME'] path = local.env['PATH'] local.env['PATH'] = "{ohome}/bin:{ohome}/OPatch:{path}".format(ohome=ORACLE_HOME, path=local.env['PATH']) osTyp = cmd.uname('-s').strip() for i in patch: if osTyp == 'Linux': cmd.unzip('-o',"/u03/p{}_*.zip".format(i)) local.cwd.chdir('/u03/{}'.format(i)) subprocess.run('pwd', shell=True) #subprocess.run('opatch apply -silent', shell=True) print('Patch applied') elif osTyp == 'SunOs': cmd.unzip("p{}_121020_Solaris-x86-64.zip".format(i)) else: print("!!\n!! unable to determine OS type !!\n!!")Content of /u03:
[oracle@cdb1 u03]$ ls -ltr total 97380 drwxr-xr-x. 3 oracle oinstall 4096 Jun 19 2017 app -rwxrwx---. 1 oracle oinstall 99183505 Oct 17 20:57 p6880880_121010_Linux-x86-64.zip -rwxrwx---. 1 oracle oinstall 451814 Oct 17 21:01 p21171382_12102180417_Generic.zip -rwxrwx---. 1 oracle oinstall 73502 Oct 17 21:10 p21463894_121020_Linux-x86-64.zipError:
File "/usr/local/lib/python3.6/site-packages/plumbum/path/local.py", line 354, in chdir os.chdir(str(newdir)) FileNotFoundError: [Errno 2] No such file or directory: '/u03/21171382'