following eric's suggestion, you can try the reverse, you can check for
one of your shell's environment variables that would not exist when
run in cron. run the command 'set' to see your current shell's env vars.

I tried using TERM and it was different when run in cron and shell.

HTH!

Lawrence

eric pareja wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ludwig,

You can set environment variables in your crontab. See crontab(5). In
your script, you can then test for the environment variable which you
set up in your crontab.

On Wed, Oct 15, 2008 at 3:29 PM, Ludwig Isaac Lim  wrote:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: http://getfiregpg.org

iEYEARECAAYFAkj1ricACgkQqYbDibguQtlXYgCfZm+6o8wY/mkJMMmyxAKI4fwc
gIMAmwXIcek/qEwuIgftZhuK3pJYJxMa
=RCyr
-----END PGP SIGNATURE-----


  
    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?
    

  

_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to