#!/bin/bash

# Absolute paths for torrent app and bin
TORRENT_APP="/Applications/Zach/Internet/Transmission.app"
TORRENT_BIN="${TORRENT_APP}/Contents/MacOS/Transmission"

# Bail if the load is high
if ! ~/bin/video/checkLoad.sh; then
	exit 0
fi

# Start the torrent app if it isn't running
if ! ps auwx | grep -v grep | grep -q "${TORRENT_BIN}"; then
	open "${TORRENT_APP}"
fi
