Skip to content

Instantly share code, notes, and snippets.

@kugelblitzz
Last active March 4, 2022 14:24
Show Gist options
  • Save kugelblitzz/dc34e51e5b341aa8e2c3e9fde7b024d3 to your computer and use it in GitHub Desktop.
Save kugelblitzz/dc34e51e5b341aa8e2c3e9fde7b024d3 to your computer and use it in GitHub Desktop.
#!/bin/bash
journalPath=$(/usr/bin/find /var/log/ -name system.journal | /bin/sed 's:[^/]*$::')
rmCommandParam=$journalPath*@*
count=$(/bin/ls -l $journalPath | /usr/bin/wc -l)
#echo $count
#Only runs if more than 2 files are there
if [[ $count -gt 3 ]]
then
/bin/rm $rmCommandParam
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment