Skip to content

Instantly share code, notes, and snippets.

@sdkks
Created July 14, 2018 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdkks/1cc7f9dff558092accbb8eb9993b6c21 to your computer and use it in GitHub Desktop.
Save sdkks/1cc7f9dff558092accbb8eb9993b6c21 to your computer and use it in GitHub Desktop.
Vacuum journalctl of nodes in your inventory
#!/usr/bin/env bash
exitCode(){
case $1 in
0)
echo "Completed with success"
;;
*)
echo "Exited with failure: $1"
;;
esac
}
for NODE in node{1..4}; do
echo "Vacuuming on $NODE"
ssh $NODE sudo journalctl --vacuum-time=6h
exitCode $?
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment