Skip to content

Instantly share code, notes, and snippets.

@Avyd
Created February 13, 2014 01:36
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 Avyd/8968131 to your computer and use it in GitHub Desktop.
Save Avyd/8968131 to your computer and use it in GitHub Desktop.
Linux_Process_Logger.sh
#!/bin/bash
while true ; do
date=$(date +"%T-%d-%m-%y")
name=pslist
ps aux >> $name && echo "--------------------------------------------------------------------------------------------" >> $name
echo $date >> $name
echo $date
filesize=`du $name | awk '{print $1}'`
echo " Current size:" $filesize
if [ $filesize -gt 102400 ]
then
echo "Gzip generated!"
gzip -9c $name >> $name-$date
fi
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment