curl --user user:pass -s https://tomcatHost/manager/text/list | tail -n+2 | cut -d':' -f1 | grep -v "manager" | xargs -L1 -I% curl --user user:pass -s https://tomcatHost/manager/text/undeploy?path=%
curl --user user:pass -s https://tomcatHost/manager/text/list
get list of apps
OK - Listed applications for virtual host localhost
/develop:running:0:develop
/feature-actuator:running:0:feature-actuator
/manager:running:0:manager
tail -n+2
remove first line
/develop:running:0:develop
/feature-actuator:running:0:feature-actuator
/manager:running:0:manager
cut -d':' -f1
get context path - first block before colon /develop:running:0:develop
. -d':'
defines colon separator. -f1
first column.
/develop
/feature-actuator
/manager
grep -v "manager"
keep manager. -v
inverts grep
/develop
/feature-actuator
xargs -L1 -I% curl --user user:pass -s https://tomcatHost/manager/text/undeploy?path=%
pass result to curl to undeploy each of resulting contexts. -L1
to call curl for each line. -I%
to have a %
placeholder
in the same way - update all docker images:
docker images | grep -v REPO | cut -d' ' -f1 | xargs -L1 docker pull