0

I have some wsadmin python scripts and i tried to include them in single script as below i need to execute all these scripts with the help of single wrapper script,but i have been facing errors while executing it.so can anyone kindly let me know whats wrong with my script here

#!/usr/bin/env python3

sh wsadmin.sh -lang jython -f /home/Devop/listApps.py
sh wsadmin.sh -lang jython -f /home/Devop/cluster.py
sh wsadmin.sh -lang jython -f /home/Devop/heap.py
sh wsadmin.sh -lang jython -f /home/Devop/Dslist.py
sh wsadmin.sh -lang jython -f /home/Devop/listservers.py

root@bin]# ./wsadmin.sh -lang jython -f /home/Devop/wrapper.py
WASX7209I: Connected to process "server1" on node localhostNode02 using SOAP connector;  The type of process is: UnManagedProcess
WASX7017E: Exception received while running file "/home/Devop/wrapper.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  (no code object) at line 0
  File "<string>", line 3
    sh wsadmin.sh -lang jython -f /home/Devop/listApps.py
       ^
SyntaxError: invalid syntax

I am getting this syntax error

  • See https://stackoverflow.com/questions/1186789/what-is-the-best-way-to-call-a-script-from-another-script for a number of different solutions, including kasko's suggestion below. – F Rowe Dec 08 '20 at 13:52

1 Answers1

-1

what you have now could be used if you rename /home/Devop/wrapper.py to /home/Devop/wrapper.sh with full path to wsadmin.sh inside and run from: root@bin]# /home/Devop/wrapper.sh

But I believe you are using python in a wrong way. I would suggest you to define functions for each of your python file and include them in one base script to run.

kasko
  • 1