![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Install a cron from a Perl script | garric | Shell Programming and Scripting | 2 | 09-13-2007 02:00 AM |
| Cron job for Perl script | man | UNIX for Advanced & Expert Users | 3 | 07-26-2007 10:20 AM |
| How to determine the script is called from CRON? | wes_brooks | Shell Programming and Scripting | 15 | 09-10-2005 09:04 AM |
| script to go to a different dir to run a commandline prompt in that dir | ann_124 | Shell Programming and Scripting | 2 | 11-29-2004 10:25 AM |
| gzip in shell script called by cron | hbau419 | Shell Programming and Scripting | 2 | 02-05-2002 03:03 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
How to determine if a script (perl) was called from a CRON job or commandline
Hi,
Is there a way to determine if a Script is called from a CRON job or from a commandline Gerry. |
| Forum Sponsor | ||
|
|
|
|||
|
Report from cron vs. command line
cron is pretty good about reporting to the user its status, i.e. whether it's running / active. If you're suspicious, then I would suggest placing an echo
statement (1.) in the/(a) cron script and noting its affect. I suggest you have a look at the man page for cron as well. 1. echo "This output has been created by cron..." Good luck! |
|
|||
|
If your UNIX maintains a PPID variable in the environment then this will point to cron:
# echo $PPID 86838 # ps -fp 23266 UID PID PPID C STIME TTY TIME CMD root 23266 1 0 03 Jan - 1:37 /usr/sbin/cron If not then (a lot looser), you could look at the TERM variable. THis is usually 'dumb' for cron whereas users will have a real terminal type; like vt220, wy50 etc. cheers |
|||
| Google UNIX.COM |