if it's inside the .bash_history file, then it was executed via cmd line. for cron, you can check the /var/cron/log file
On Wed, Oct 15, 2008 at 3:29 PM, Ludwig Isaac Lim <[EMAIL PROTECTED]>wrote: > Hi: > > Is there a way of knowing if a particular shell script is being > executed from crontab? If > there's no way to know if it was executed from crontab, can a particular > shell script determine if > it was executed via command line? > > I want to achieve something like below > > if executed from command line > then > # user can see the message at the same time it will be logged to a > file > echo "...." | tee -a $LOG > else > # We didn't execute it from command line, most likely it got > executed via crontab > # no point in echoing to the terminal > echo "....." >> $LOG > fi > > > Thank you in advance. > > Regards, > > Ludwig > > > > _________________________________________________ > Philippine Linux Users' Group (PLUG) Mailing List > http://lists.linux.org.ph/mailman/listinfo/plug > Searchable Archives: http://archives.free.net.ph > -- Keyboard error, press F1 to continue
_________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List http://lists.linux.org.ph/mailman/listinfo/plug Searchable Archives: http://archives.free.net.ph

