Skip to content

Instantly share code, notes, and snippets.

@WaterSibilantFalling
Created September 21, 2017 14:04
Show Gist options
  • Save WaterSibilantFalling/9a8ad8e3b38d735422a120401b0a6ecb to your computer and use it in GitHub Desktop.
Save WaterSibilantFalling/9a8ad8e3b38d735422a120401b0a6ecb to your computer and use it in GitHub Desktop.
script to easily and regularlly run a bleech-bit run.
#!/bin/bash
# ideally the 'firefox-bin' in line 3 of this would be replaced by $var,
# but substitution is not working: I can't $var substitiute in here
# (the $var could be an 'egrep aaa\|bbb\|ccc ... ' list var, too.)
# is firefox running
FIREFOX_RUNNING=`ps -a \
| awk '{ print $4 }' \
| grep firefox-bin \
| sort -u
`;
# ideally this would be suspended for 9/10ths of the time
# how to suspend a job, programatically, from bash -- send it the ^Z
# ? do I send it the SIGTTIN signal?
# ? do I some how include a 'suspend' command in the loop, but how?
# ? do I use bash's coproc command?
# clean caches etc if firefox is not runndding.
if [[ "$FIREFOX_RUNNING" != "firefox-bin" ]]
then
nice -n 19 bleachbit --preset --clean 2>/dev/null 1>/dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment