I want to echo to the terminal if the script is being executed by me, in the flesh or I want to echo to a log file if it is being done via a cron job.
Ubuntu 16.04
example:
#!/bin/bash
if [ ***** ]; then
echo "You executed this script just now !";
else
echo "You were executed by the server cron at ${date}" >> example.log
fi
I rewrote the above because I thought it would be a simpler way to explain it. It's a more direct and cleaner example.