Whitespace fix
Remove redundant exit statement
Fix cli parsing

Always shift first argument when successfully parsing an argument.
Set APP_NAME to the correct value.

Use more flexible log level instead of separate flags.
Switch to case statements for more concise code.
Consistently use [[ and change formatting of if

Move `then` keyword to first line.
Simplify archiving

Use tar -a for automatic file format detection. Note that this requires
a suffix of `.lzma` as `.lz` maps to the lzip compression skip. Also, an
appropriate version of GNU tar.

Make sure all references to file names are quotes, because bash.
Move PID calculation after JPS check
Revert accidental removal of app_name check
Fix compression/copy and log dir check

*.tgz extension needs explicit support.

Copy was missing recursive flag.
Tar command required a dash because of the preceding -C
Safe temp file creation and log copying
Merge pull request #1 from datasift/feature/fixes

Feature/fixes