Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslamlatheef authored Jun 12, 2020
1 parent d72d2c7 commit 6ac5f78
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Deletedeadpods.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Date: 04/18/2017
#
# Script Purpose: Cleanup completed or dead pods
# Version : 1.0
#


#Delete all Error, Completed, DeadlineExceeded, or ContainerCannotRun pods.
oc get pods --all-namespaces --no-headers | awk '$4 == "Error" \
|| $4 == "Completed" \
|| $4 == "DeadlineExceeded" \
|| $4 == "ContainerCannotRun" \
{system("bash -c '\''oc delete pod -n "$1" "$2" '\''")}'

#Force kill any hanging pods
oc get pods --no-headers | awk '$4 == "Terminating" \
{system("bash -c '\''oc delete pod -n "$1" "$2" --grace-period=0 '\''")}'

exit 0

0 comments on commit 6ac5f78

Please sign in to comment.