I'm learning Jenkins these days and I faced a situation. I need to execute conditional undeploy
on glassfish. I want to undeploy an application only if it exsits in the server. Is there a way to do this in a single command line?
To do so, I used the followin Bash code:
apps=`asadmin list-applications -t --user=admin --passwordfile=password.txt`
for app in $apps
do
if [ $app = "the_name_of_your_app" ]
then
asadmin --user=admin --passwordfile=password.txt undeploy the_name_of_your_app
fi
done;
PS: the content of password.txt is a single line: AS_ADMIN_PASSWORD=admin
I hope it will help someone someday =)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.