You could call the same program using different names, one name when
run from cron, anothe r when run interactively. Put a test in the
program to check which name is was invoked as and take action
accordingly. Here's a snippet:
#!/usr/bin/perl
if ( $0 eq "xx" ) {
print "program called from cron\n";
} else {
print "program run manually\n";
}
Call the program as "xx" from the crontab entry. "xx" can be a
symlink to the real program name.
Scot
On Tue, 8 Mar 2005 20:16:16 -0600, Steve Swantz
<aintboeingaintgoing at gmail.com> wrote:
> I'm sure this will be easy for someone, but I'm not finding it now...
>
> I have a perl program that normally runs by cron, but occasionally
> manually. I want to handle the output differently depending on how it
> is run. Yes, I could add a flag to the arguments, but I seem to
> remember there being a more fundamental way to determine at runtime.
> Anyone know?
>
> Thanks,
> Steve