We have a basic webserver (the one that installs with linux, apache I think)
and we have another internal server that tracks defects. Now I can run a
script call Report from the command line as user and get the information
that I need. So what we decided to do was make a crontab that would call a
script file. In that script file we have a call to Report and we place the
output of Report to a readme file in the pub directory of the server.
If we run the script file in a normal shell it works fine the new file is
generated and everything. But within the crontab it does nothing. At first
we saw an error saying the Report command was not found, we fixed that but
it still does not work. What are we doing wrong?
Thanks.
|
|
0
|
|
|
|
Reply
|
defsetup (6)
|
3/20/2006 7:25:19 PM |
|
On 2006-03-20, Arint� <defsetup@hotmail.com> wrote:
> We have a basic webserver (the one that installs with linux, apache I think)
^^^^^
There are many linux distributions; in the future you'll want to note
which one. Slackware and RedHat come with different major versions of
apache, for example.
> If we run the script file in a normal shell it works fine the new file is
> generated and everything. But within the crontab it does nothing. At first
> we saw an error saying the Report command was not found, we fixed that but
> it still does not work. What are we doing wrong?
"It still does not work" is a singularly poor problem report. What goes
wrong? What errors do you see? What does the mail sent by cron say,
for example? Since it works from a login shell, but not from crontab,
it's probably an environment issue, but without more detail from you
nobody could reliably guess which environment variables you need (or
even if it's a different problem altogether).
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information
|
|
0
|
|
|
|
Reply
|
kkeller-usenet (1289)
|
3/20/2006 8:21:30 PM
|
|
On Mon, 20 Mar 2006 14:25:19 -0500, Arint�
<defsetup@hotmail.com> wrote:
> We have a basic webserver (the one that installs with linux, apache I think)
> and we have another internal server that tracks defects. Now I can run a
> script call Report from the command line as user and get the information
> that I need. So what we decided to do was make a crontab that would call a
> script file. In that script file we have a call to Report and we place the
> output of Report to a readme file in the pub directory of the server.
>
> If we run the script file in a normal shell it works fine the new file is
> generated and everything. But within the crontab it does nothing. At first
> we saw an error saying the Report command was not found, we fixed that but
> it still does not work. What are we doing wrong?
>
> Thanks.
>
I don't know exactly what you are doing, but some facts to remember
about crontab are:
the PATH is shorter than usual; usually it contains just "/usr/bin:/bin"
other environment variables might not be set
the % character has a special meaning
See "man 5 crontab".
--
Put your best foot forward. Or just call in and say you're sick.
|
|
0
|
|
|
|
Reply
|
bmarcum (929)
|
3/20/2006 8:48:02 PM
|
|
Arint=E9 wrote:
> We have a basic webserver (the one that installs with linux, apache I thi=
nk)
> and we have another internal server that tracks defects. Now I can run a
> script call Report from the command line as user and get the information
> that I need. So what we decided to do was make a crontab that would call=
a
> script file. In that script file we have a call to Report and we place t=
he
> output of Report to a readme file in the pub directory of the server.
>
> If we run the script file in a normal shell it works fine the new file is
> generated and everything. But within the crontab it does nothing. At fi=
rst
> we saw an error saying the Report command was not found, we fixed that but
> it still does not work. What are we doing wrong?
You provide little information, so I'll guess at a few possible issues.
Since the script works for you, the first thing we may want to look at
is what user is the process in crontab running as ? If it is running as
anything but you, then we need to look at the difference between you
and that other user. First, log on as user X and step through the
script manually. That may help you find the problem fairly quick if the
script isn't too long.
The main problem here would be rights and environment variables. The
shell may also be an issue.
For rights/permissions, look at all the resources the script is
accessing and make sure that the other user has the needed permissions.
If you run the cron job as user X, and it writes to your personal
directory, the user X needs permission to write to your directory.
Since this is a two system setup, you need to make sure user X has the
proper permissions to resources on both systems.
Next we have environment variables. Does your script explicitly access
any environment variables ? If so, then su to user X and echo out the
variables. If they are not what you get as yourself, then you may have
found the problem. You may need to copy some .profile or .(shell)rc
info to the appropriate files. You may need to do this even if it is
running as you, as some files are only loaded for "login" shells.
Things like path data can be avoided by specifying complete paths. You
can also use "su" and "which" to see if there are any differences in
commands being used.
Another thing can be the shell. If user X is setup for a different
shell, and the script doesn't specify a shell, then you need to correct
one or the other. Add the shell to the top of the script to make sure
the script is run under a particular shell.
#!(path of shell)
There are many other things it could be as well, so why don't you tell
us more ? Does part of the script work, but not another ? Is a certain
command failing ? Do you get any error message ? What version and disto
of Linux ? What version of Apache ? If it is not confidental, post the
part of Report that isn't working.
Dean G.
|
|
0
|
|
|
|
Reply
|
Dean
|
3/20/2006 11:55:37 PM
|
|
I guess it was the path because it is now working....
Thanks for your help and next time i will be more specific.
|
|
0
|
|
|
|
Reply
|
defsetup (6)
|
3/21/2006 1:42:00 PM
|
|
|
4 Replies
34 Views
(page loaded in 0.082 seconds)
Similiar Articles: newbie question: shell script to monitor server performance - comp ...I'm new to unix scripting. I need a script that to monitor our Solaris 8 server performance. The script will run at an interval which captures: 1) CP... Newbie question: Importing .csv data into Java DB tables - comp ...I am trying to import five simple .csv files into separate Java DB tables using NetBeans 5.5, but I can't seem to do it. This strikes me as something ... Newbie question: How do I remove double spaces from a field ...Hi all! I have one text field in a table that, in some cases, contains double spaces between words. How do I replace those double spaces with a singl... Newbie Question: Inference lines - comp.cad.solidworksIs there a way to turn on the Inference lines if they are not showing. I just received a student version 08/09 software and they are not shown when ... Newbie question about rotate a picture using OpenGL - comp ...Hi, I am new to this field and want to implement a function that can rotate a picture using OpenGL. This picture is just a normal pixmap so I wonder ... Newbie Question: delete all non alphanumeric characters - comp ...On Jul 21, 2006, at 2:05 PM, Tom Werner wrote: > Logan Capaldo wrote: >> >> On Jul 21, 2006, at 1:53 PM, Theallnighter Theallnighter wrote: >> >>> Hi all, >>> how can ... How to turn off SNMP & change the default credential - Newbie ...How to turn off SNMP & change the default credential - Newbie ... How to turn off SNMP & change the default credential - Newbie question Unix NFS mount permission denied - Solaris 10 servers (newbie question ...We are trying to NFS mount a file system securely from serverA to serverB and to serverC. There is a valid entry in /etc/dfs/dfstab file at serve... Are newbie questions OK in here? - comp.lang.asm.x86If yes, then I will have questions that involve more than the syntax. Things like, well I'll just ask one. Microsoft has eliminated the inline assem... Interactive cursor in Matlab plots... - comp.soft-sys.matlab ...Newbie question...I want to include in a Matlab figure a "top to bottom" cursor line that the user can slide back and forth so that they can observe i... Newbie Question : INTERNET->Router1->Router2 ? - Cisco Support ...Newbie Question : INTERNET->Router1->Router2 ? Hello, I am learning and reading the CCNA / CCENT books , just to understand how it works. (It is only the se McAfee Communities: Newbie questionFirst let me say I know almost nothing about computer security or how to use McAfee products. Several times I have performed a scan and I always get the same result ... 7/23/2012 2:32:02 AM
|