03-22-2006
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!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm puzzled by this one. I hope you can explain it to me.
I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies
2. Shell Programming and Scripting
Hello expert,
What I want is to determine whether the script is called from CRON or it is executed interactively?
I tried the following but no luck:
#!/bin/ksh
cronID=`pgrep -x cron`
GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'`
if ; then
echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies
3. UNIX for Advanced & Expert Users
Although there are many threads on this forum regarding cron, none have specifically answered my question. So hopefully someone can shed some light on what I'm doing wrong..
I have a perl script that I want to run in a cron job. Since I've read that cron doesn't have any environments set, I... (3 Replies)
Discussion started by: man
3 Replies
4. UNIX for Dummies Questions & Answers
Hello evreyone,
this is my first post, and to say i'm new to this is an understatement.
I know very little about perl scripts and hope some one can help me.
i'm looking to get a script that a cron job can execute.
what the script needs to to is
1) connect to a mysql database
2) go to a... (2 Replies)
Discussion started by: Exader
2 Replies
5. Shell Programming and Scripting
Hi,
i have an autosys job 'AUTJOBA' that calls a script script1.sh
Now, inside the script i would like to know the autosys job that kicked off this script.
When AUTJOBA runs script1.sh, will it set an environmental variable for this shell session that can be accessed within this script?
... (1 Reply)
Discussion started by: ysrinu
1 Replies
6. Shell Programming and Scripting
Hello,
I have the following script which works fine when ran from the command line:
#!/apps/python/2.3.4/bin/python
import os
import sys
import time
user = os.getenv("USER")
string = time.strftime("%m%d%y0000 " + user, time.gmtime())
However, when I have this run by crontab, I... (4 Replies)
Discussion started by: cooldude
4 Replies
7. Shell Programming and Scripting
I am trying to get the string containing date - in a specfic format actually, although I think that part is inconsequencial - 1110226^1110226^1110226^1110226^1110226 - through echo or printf or in some other way - created within a cront job and passed as a parameter to a perl script.
Now, I know... (3 Replies)
Discussion started by: v8625
3 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
I am calling a series of shell scripts via CRON so everything is running as root. However, in my error log file I am seeing the following errors. Please can anyone offer any advise as to the possible causes and solution to prevent the errors from appearing.
The Error 1227 seems to... (2 Replies)
Discussion started by: daveu7
2 Replies
9. Shell Programming and Scripting
Hi,
My shell script not getting called through cron job.
The same works fine when executed manually.
I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins:
*/5 * * * * /home/myfolder/abc.sh... (17 Replies)
Discussion started by: Dejavu20
17 Replies
10. Shell Programming and Scripting
Hello all,
I have a question regarding the difference betwen cron and command line.
What I would like to do is to print a statement into a logfile if a script has been executed from cron or from command line.
It should be as:
#!/bin/bash
if <Check if this script has been... (3 Replies)
Discussion started by: API
3 Replies
CRON(8) System Manager's Manual CRON(8)
NAME
cron - clock daemon
SYNOPSIS
auth/cron [-c]
DESCRIPTION
Cron executes commands at specified dates and times according to instructions in the files /cron/user/cron. It runs only on an authentica-
tion server. Option -c causes cron to create /cron/user and /cron/user/cron for the current user; it can be run from any Plan 9 machine.
Blank lines and lines beginning with # in these files are ignored. Entries are lines with fields
minute hour day month weekday host command
Command is a string, which may contain spaces, that is passed to an rc(1) running on host for execution. The first five fields are integer
patterns for
minute 0-59
hour 0-23
day of month 1-31
month of year 1-12
day of week 0-6; 0=Sunday
The syntax for these patterns is
time : '*'
| range
range : number
| number '-' number
| range ',' range
Each number must be in the appropriate range. Hyphens specify inclusive ranges of valid times; commas specify lists of valid time ranges.
To run the job, cron calls host and authenticates remote execution, equivalent to running rx host command (see con(1)). The user's profile
is run with $service set to rx.
Cron is not a reliable service. It skips commands if it cannot reach host within two minutes, or if the cron daemon is not running at the
appropriate time.
EXAMPLES
Here is the job that mails system news.
% cat /cron/upas/cron
# send system news
15 8-17, 21 *** helix /mail/lib/mailnews
%
SOURCE
/sys/src/cmd/auth/cron.c
SEE ALSO
con(1), rc(1)
CRON(8)