简体   繁体   English

如何在单个包装器 shell 脚本中运行 wsadmin 脚本

[英]How to run wsadmin scripts in single wrapper shell script

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我有一些 wsadmin python 脚本,我尝试将它们包含在单个脚本中,如下所示我需要在单个包装脚本的帮助下执行所有这些脚本,但是我在执行它时遇到了错误。所以任何人都可以让我知道什么我的脚本在这里错了

#!/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我收到此语法错误

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如果您将 /home/Devop/wrapper.py 重命名为 /home/Devop/wrapper.sh 并在其中运行 wsadmin.sh 的完整路径并从以下位置运行,则可以使用您现在拥有的内容:root@bin]# /home/Devop/wrapper .sh

But I believe you are using python in a wrong way.但我相信您以错误的方式使用 python。 I would suggest you to define functions for each of your python file and include them in one base script to run.我建议您为每个 python 文件定义函数,并将它们包含在一个要运行的基本脚本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从一个脚本运行多个 Python/Shell 脚本 - How to run multiple Python/Shell scripts from one script 如何在单个包装脚本中包含和运行所有 python 脚本 - How to include and run all python scrips in single wrapper script 如何使用单个 python(.py) 脚本运行多个 python 脚本 - How to run multiple python scripts using single python(.py) script 如何编写python脚本来与shell脚本进行交互 - How to write a python script to interact with shell scripts 如何在Python中运行一系列异步Shell脚本 - How to run a sequence of asynchronous shell scripts in Python 如何使用一个单独的shell命令加载python IDE shell环境并运行python脚本? - How to load a python IDE shell environment and run a python script with one single shell command? 如何在带有 args 的 python 脚本中运行多个脚本 - How to run multiple scripts in a python script with args 如何从python中的脚本运行多个脚本 - How to run multiple scripts from a script in python 如何使用UNIX Shell脚本并行运行单个进程多次? - How to run a single process multiple times in parallel using a UNIX shell script? 在shell脚本和移动文件中意外使用mv。 shell脚本默认在mac上运行在哪里? - Accidentally used mv in shell script and moved files. Where do shell scripts run by default on mac?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM