Created
January 19, 2017 11:28
-
-
Save mrizvic/ac8b7daa6af3fed948b37820e901a9b4 to your computer and use it in GitHub Desktop.
cronjob for periodic report in HTML and cowsay format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
WORKFILE=/tmp/myreport.out | |
cat <<EOF > $WORKFILE | |
From: username <[email protected]> | |
To: [email protected] | |
Subject: your html report | |
Content-Type: text/html; charset="us-ascii" | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head><title></title> | |
</head> | |
<body> | |
<pre> | |
$(mysql -te "SELECT this FROM that WHERE something LIKE 'this%';" | cowsay -n ) | |
</pre> | |
</body> | |
</html> | |
EOF | |
sendmail [email protected] < $WORKFILE | |
unlink $WORKFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment