Skip to content

Instantly share code, notes, and snippets.

@whs2k
Last active August 29, 2018 21:38
Show Gist options
  • Save whs2k/4fe94f040d61f1ddb6eafec9f8bd57df to your computer and use it in GitHub Desktop.
Save whs2k/4fe94f040d61f1ddb6eafec9f8bd57df to your computer and use it in GitHub Desktop.
#!/bin/bash
#
#1. Create Log Folders For each Day In New Location:
#
LOGPATH='/data/wsolomon/workspace/projects/Claim_Extractor_Pipeline/logs' #LOGPATH='/data/bdr/logs/bdr-ptab'
RUNDATE=$(date +'%Y%m%d')
JOB=`basename $0`
mkdir -p $LOGPATH
exec >$LOGPATH/$JOB.$RUNDATE.log
exec 2>&1
#
#2. Search For Largest 20 Files in /data folder
#
du -a /data | sort -n -r | head -n 20
#
#3. Find Size of Folder Contents
#
du --max-depth=1 -h
#
#4. Zip a Folder
#
tar -zcvf new_dirName.tar.gz directory_to_zip/
#
#5. Unzip to a Folder
#
tar -zxvf new_dirName.tar.gz directory_to_unzip
#
# 6. Find and kill a job running as a shell script, e.g. bdr-TEST.sh
#
ps -ef | grep bdr-TEST #step one to find the pid, first column,
kill -9 <pid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment