Sample Header Ad - 728x90

Check if script is started by cron, rather than invoked manually

38 votes
11 answers
40068 views
Is there any variable that cron sets when it runs a program ? If the script is run by cron, I would like to skip some parts; otherwise invoke those parts. How can I know if the Bash script is started by cron ?
Asked by daisy (55777 rep)
Aug 31, 2012, 09:07 AM
Last activity: Aug 1, 2025, 12:17 PM