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.
__________________________________________________________________

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to