首页 > 解决方案 > 如何在单个包装脚本中包含和运行所有 python 脚本

问题描述

我有一些 12 个 python 脚本,我分别执行它们现在我想将这 12 个脚本包含在单个 shell 包装器中,并希望运行这个可以一次执行所有 12 个的包装器。我已经尝试了下面的简单外壳,但无法执行它

#!/bin/bash
/home/<user>/serverlist.py
/home/<user>/cluster.py
/home/<user>/listApps.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 "./home/Devop/listApps.py" 
       ^
SyntaxError: invalid syntax`
I  am getting this syntax error

标签: pythonshellunixwebsphere

解决方案


#!/bin/bash
python3 /home/<user>/serverlist.py #or just python
python3 /home/<user>/cluster.py
python3 /home/<user>/listApps.py

推荐阅读