Skip to content

Instantly share code, notes, and snippets.

@ginokent
Created November 8, 2018 10:24
Show Gist options
  • Save ginokent/c3ca3eaefdb31cca5a9a4fe5ba887c2b to your computer and use it in GitHub Desktop.
Save ginokent/c3ca3eaefdb31cca5a9a4fe5ba887c2b to your computer and use it in GitHub Desktop.
#!/bin/bash
getps() {
/usr/bin/ionice -c 3 /usr/bin/nice -n 19 /bin/bash -c '{
TODAYLOG="$HOME/getps_$(/bin/date +%Y%m%d).log"
YESTERDAYLOG="$HOME/getps_$(/bin/date -d yesterday +%Y%m%d).log"
{
/bin/echo "==> delimiter <==";
/bin/date -Is;
/bin/ps auxfewww;
/bin/echo;
} >>"${TODAYLOG}" 2>&1;
if [ -f "${YESTERDAYLOG}" ] && [ -r "${YESTERDAYLOG}" ]; then gzip "${YESTERDAYLOG}"; fi;
}'
}
getps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment