test if script called by cron
Jerry
jerry at seibercom.net
Mon Sep 16 12:21:51 UTC 2013
On Mon, 16 Sep 2013 12:26:59 +0100
Paul Macdonald articulated:
>
> Hi,
>
> Is there a simple way of testing whether a given script was called
> via cron,
>
> I'd rather find a solution that would work from within the script
> rather than setting an environment variable in the crontab.
>
> thanks
> Paul.
>
> (anyone here going to EuroBSD con?)
If you want to learn if the running script was called via cron, this
would work, assuming you are running Bash.
if [[ ! -t 0 ]]; then
echo "Running from Cron"
fi
--
Jerry ♔
Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__________________________________________________________________
More information about the freebsd-questions
mailing list