notes/daily manning email for callback staffing-Zg4bJLuB.sh
#!/bin/bash

#Copyleft 2015 Kris Occhipinti http://filmsbykris.com
#Released under GNU AGPLv3 - http://www.gnu.org/licenses/agpl-3.0.txt

#This script pulls the daily staffing PDF from the Callback Staffing website

#and emails it to set address
#Please fill in 'username', 'password', and 'mailto'
#Use a cron job to set daily 


username="<user>"
password="<password>"
mailto="<email>"
subject="GNFD Manning $(date)"
msg="Greater Naples"
baseurl="https://www.callbackstaffing.com/Application"
date=$(date --date="$(date +'%m/%d/%Y')" +%s)
output="$HOME/tmp/staffing.pdf"
cookie="$HOME/tmp/cookie"

#login and download PDF
curl -c "$cookie" "$baseurl/Login/process" -d "username=$username&password=$password"

curl -b "$cookie" "$baseurl/UserPanel/Schedule/ExportDay/?start=$date" -o "$output"

#send mail

echo "$msg" | mailx -a "$output" -s "$subject" -- $mailto

#cleanup

rm "$output" "$cookie"

syntax highlighted by Code2HTML, v. 0.9.1