[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



#!/bin/sh

FD1=`ls -l /proc/$$/fd/1 | cut -d '>' -f2`
echo $FD1 >> /tmp/test.sh.out

Gave me this:
[cfowler at cfowler tmp]$ tail /tmp/test.sh.out 
pipe:[266205]
pipe:[267448]
pipe:[268442]
pipe:[269312]


On Mon, 2005-06-27 at 09:24, David A. De Graaf wrote:
> On Mon, Jun 27, 2005 at 12:17:00AM -0400, Christopher Bergeron wrote:
> > Does anyone know of an easy way for my script to determine if it's being 
> > run from cron or from a user shell? 
> 
> Read about the 'tty' command.
> Try this example script, both manually and via cron:
> 
>   ANS=`tty`
>   echo ANS: $ANS


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00789" href="msg00789.html">[ale] Bash:  How to determine if called from cron?</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00752" href="msg00752.html">[ale] block dev over net?</a></strong>
<ul><li><em>From:</em> dcorbin at machturtle.com (David Corbin)</li></ul></li>
<li><strong><a name="00753" href="msg00753.html">[ale] block dev over net?</a></strong>
<ul><li><em>From:</em> jjj863 at gmail.com (Jerry Yu)</li></ul></li>
<li><strong><a name="00777" href="msg00777.html">[ale] block dev over net?</a></strong>
<ul><li><em>From:</em> dcorbin at machturtle.com (David Corbin)</li></ul></li>
<li><strong><a name="00782" href="msg00782.html">[ale] block dev over net?</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00783" href="msg00783.html">[ale] Bash:  How to determine if called from cron?</a></strong>
<ul><li><em>From:</em> christopher at bergeron.com (Christopher Bergeron)</li></ul></li>
<li><strong><a name="00786" href="msg00786.html">[ale] Bash:  How to determine if called from cron?</a></strong>
<ul><li><em>From:</em> dad at datix.2y.net (David A. De Graaf)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00786.html">[ale] Bash:  How to determine if called from cron?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00788.html">[ale] possible to use hard drives that have bad blocks ?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00786.html">[ale] Bash:  How to determine if called from cron?</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00789.html">[ale] Bash:  How to determine if called from cron?</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00787"><strong>Date</strong></a></li>
<li><a href="threads.html#00787"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>