我正在my.sh
通过Maven在shell脚本()下执行,如下所示。
#!/bin/sh
oc login "https://server-name:8443" --insecure-skip-tls-verify--
echo "Enter userid password"
UN="username"
PWD="password"
-u $UN -p $PWD
oc project dev1
oc port-forward image-name 1521:1521 && exit
聚甲醛
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>my-exec</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>sh</executable>
<arguments>
<argument>-c</argument>
<argument>${project-home}/resources/my.sh</argument>
</arguments>
</configuration>
</plugin>
但是问题是当运行mvn命令(mvn spring-boot:run -Dspring-boot.run.profiles=it
)时
然后航站楼停在原处Forwarding from 127.0.0.1:1521 -> 1521
并停留在那里而没有前进。
如下更改最后一行后,它起作用了。
nohup oc port-forward image-name 1521:1521 > /dev/null 2>&1 </dev/null &
echo
> / dev / null将父日志输出通过管道传递到void目录,这是一种轻松启动后台进程的解决方法
nohup
-从父进程断开正在启动的后台子进程的输入和输出,并告诉子进程不要响应HUP(挂断)信号
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句