cron/http absolute directories

S

Sean O'Dwyer

Hi,

I have a Perl script running on an apache server which contains the
following lines:


require('../variables-global.pl');
require('variables-local.pl');


When I call the script manually, via http, it works fine. But when it
runs automaticaly via cron I get an e-mail from the cron daemon saying
"Can't locate ../variables-global.pl at line such-and-such".

I might be missing something here about how Apache runs each call to the
script as its own process and user.

My plan to try and solve the problem is to specify absolute paths to
both these files, but I'm not sure how to do this (may be a question for
an Apache NG, I realize).

I need the script to be callable both automatically by cron and manually
by http. Is that possible? Any help appreciated.

Kind regards,

Sean
 
D

D Borland

Not 100% sure if this is correct, but someone will soon correct me if it's
not i'm sure :)

Perl inherits is working directory from whichever process runs it, so i
would ASSUME that the working directory when run from cron is something like
/usr/bin and the working directory for apache when run by http is probably
wherever the script was launched from.

Not sure if that help you, or helped to confuse you, but either way i would
suggest using absolute url's

Dagmar
 
S

Sean O'Dwyer

D Borland said:
Perl inherits is working directory from whichever process runs it, so i
would ASSUME that the working directory when run from cron is something like
/usr/bin and the working directory for apache when run by http is probably
wherever the script was launched from.

Thanks, that's what I'd always assumed, and what had been born out by my
non-cron experience with other scripts that access files in multiple
directories. I just started using cron this evening.
Not sure if that help you, or helped to confuse you, but either way i would
suggest using absolute url's

That's the plan, but I'm not sure how to specify. For example, I tried...

require('/www/cgi-bin/variables-global.pl');
require('/www/cgi-bin/specialdir/variables-local.pl');

...but that doesn't work because it starts looking for the /www/
directory STARTING in the directory that contains the script.

There must be some way to specify "start at the root level, please" --
probably just a very basic, obvious hole in my knowledge.

Still confused, but plugging away.

Cheers,

Sean
 
S

Sean O'Dwyer

I would first make a cronable script that simply displays as much
information as possible.

Cron will mail that info to you.

#!/bin/sh
pwd
echo $PATH
printenv

#(etc)

Good suggestion, I'll give it a bash, thanks.

Sean
 
G

Gregory Toomey

Sean O'Dwyer said:
Hi,

I have a Perl script running on an apache server which contains the
following lines:


require('../variables-global.pl');
require('variables-local.pl');


When I call the script manually, via http, it works fine. But when it
runs automaticaly via cron I get an e-mail from the cron daemon saying
"Can't locate ../variables-global.pl at line such-and-such".

I might be missing something here about how Apache runs each call to the
script as its own process and user.

My plan to try and solve the problem is to specify absolute paths to
both these files, but I'm not sure how to do this (may be a question for
an Apache NG, I realize).

I need the script to be callable both automatically by cron and manually
by http. Is that possible? Any help appreciated.

Kind regards,

Sean

Make no assumptions about your starting directory with cron.

Either add the following to your cron ...
(cd /some/home/dir; ./someprog.pl)

.... or in linux (and some other unix variants) will let you add variables
to your crontab as follows:

SHELL=/bin/bash
[email protected]
HOME=/home/xxx/

If cron is set up properly you will be emailed the stdout from your cron
tasks.

gtoomey
 
M

Malcolm Dew-Jones

Sean O'Dwyer ([email protected]) wrote:
: Hi,

: I have a Perl script running on an apache server which contains the
: following lines:


: require('../variables-global.pl');
: require('variables-local.pl');


: When I call the script manually, via http, it works fine. But when it
: runs automaticaly via cron I get an e-mail from the cron daemon saying
: "Can't locate ../variables-global.pl at line such-and-such".

I would first make a cronable script that simply displays as much
information as possible.

Cron will mail that info to you.

#!/bin/sh
pwd
echo $PATH
printenv

#(etc)
 
H

Helgi Briem

Not 100% sure if this is correct, but someone will soon
correct me if it's not i'm sure :)

I don't know about that, but you've been warned
several times about top-posting.

Enough is enough. Into the killfile you go.

*PLONK*
 
D

D Borland

I hope that idiot isn't Helgi isn't talking about me top-posting, there's
absolutely nothing wrong with the threads in this post - I can only assume
that this person is a sad-basta$d.

I've done nothing wrong except to reply to a post in the usual manner, so
omeone asks i qustion the post appears in the newsgroup and i reply, simple
i would have though, but obviously some of us don't like people's post
getting their before less and are seeming to act spiteful through their
jealousy for some reason, i don't know why i really couldn't care less is my
posts are always the last in the thread, or second third or first, it
doesn't matter.

Well that's my 2-cents in your face! Now i'll leave you to carry on your
pathetic exsitence you try to call a life.

Dagmar
 
A

Anno Siegel

D Borland said:
I hope that idiot isn't Helgi isn't talking about me top-posting,

He is, but top-posting isn't what you think it is.
there's
absolutely nothing wrong with the threads in this post - I can only assume
that this person is a sad-basta$d.

I've done nothing wrong except to reply to a post in the usual manner, so
omeone asks i qustion the post appears in the newsgroup and i reply, simple
i would have though, but obviously some of us don't like people's post
getting their before less and are seeming to act spiteful through their
jealousy for some reason, i don't know why i really couldn't care less is my
posts are always the last in the thread, or second third or first, it
doesn't matter.

No, you misunderstand. "Top posting" has nothing to do with the placement
of your posts in a thread. It means placing your reply on top of the
one you are replying to, instead of interleaving your comments after
what you are commenting on. You have been doing this (top-posting) from
day one in this group, and people are trying to tell you it's considered
rude. See the posting guidelines for this group, they are posted regularly.

Anno

[TOFU snipped]
 
D

D Borland

but i was the first person to reply to him and several others, so mine is
the first reply which means it is going to be the first (top) reply to
someones post. I really don't get this? I do reply to the actual post that
i am reffering to, example...

"i need help" # first post
+ "i need help" # reply to first post
+ "here yours answer" # reply to first post
+ "no you do" # reply to 'heres your answer'
+ "i can help you" # reply to first post

Ok, so it aint a great picutre, but that's they way i belive newsgroup
posting goes! If not show me what's wrong with the above.

Dagmar



Anno Siegel said:
D Borland said:
I hope that idiot isn't Helgi isn't talking about me top-posting,

He is, but top-posting isn't what you think it is.
there's
absolutely nothing wrong with the threads in this post - I can only assume
that this person is a sad-basta$d.

I've done nothing wrong except to reply to a post in the usual manner, so
omeone asks i qustion the post appears in the newsgroup and i reply, simple
i would have though, but obviously some of us don't like people's post
getting their before less and are seeming to act spiteful through their
jealousy for some reason, i don't know why i really couldn't care less is my
posts are always the last in the thread, or second third or first, it
doesn't matter.

No, you misunderstand. "Top posting" has nothing to do with the placement
of your posts in a thread. It means placing your reply on top of the
one you are replying to, instead of interleaving your comments after
what you are commenting on. You have been doing this (top-posting) from
day one in this group, and people are trying to tell you it's considered
rude. See the posting guidelines for this group, they are posted regularly.

Anno

[TOFU snipped]
 
A

Anno Siegel

D Borland said:
but i was the first person to reply to him and several others, so mine is
the first reply which means it is going to be the first (top) reply to
someones post. I really don't get this? I do reply to the actual post that
i am reffering to, example...

"i need help" # first post
+ "i need help" # reply to first post
+ "here yours answer" # reply to first post
+ "no you do" # reply to 'heres your answer'
+ "i can help you" # reply to first post

Ok, so it aint a great picutre, but that's they way i belive newsgroup
posting goes! If not show me what's wrong with the above.

I'm not sure what the above lines are supposed to demonstrate.

The problem is that you are placing your reply *above* the quoted
text you are replying to. Please do read the posting guidelines that
are posted regularly here. Excerpt:

Use an effective followup style

...

Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"Jeopardy" (because the answer comes before the question), or
"TOFU".

That's what we're kvetching about.

Anno

[more TOFU snipped]
 
D

D Borland

Well i cannot see anything wrong with my posting, it's never been moaned
about before in the 14 years i've been on the internet - So frankly i don't
care anymore, put me in your killfile if you want, as i think that anyone
who is childish enough to react like that over something so trivial is
pathetic so i don't think your replies would be of any use to me anyhow.
That and the fact i can't see anything wrong with the way i post, it's the
same as everyone else, everywhere else. But then again you alsways do have
the 'spoilt kid or the lick' trying to spoil anything anyone ever does.

Some people should have never been givin the right to life.

Well, like i said above i'll post the way i want - You don't like, so what!

Dagmar


Anno Siegel said:
D Borland said:
but i was the first person to reply to him and several others, so mine is
the first reply which means it is going to be the first (top) reply to
someones post. I really don't get this? I do reply to the actual post that
i am reffering to, example...

"i need help" # first post
+ "i need help" # reply to first post
+ "here yours answer" # reply to first post
+ "no you do" # reply to 'heres your answer'
+ "i can help you" # reply to first post

Ok, so it aint a great picutre, but that's they way i belive newsgroup
posting goes! If not show me what's wrong with the above.

I'm not sure what the above lines are supposed to demonstrate.

The problem is that you are placing your reply *above* the quoted
text you are replying to. Please do read the posting guidelines that
are posted regularly here. Excerpt:

Use an effective followup style

...

Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"Jeopardy" (because the answer comes before the question), or
"TOFU".

That's what we're kvetching about.

Anno

[more TOFU snipped]
 
A

Anno Siegel

D Borland said:
Well i cannot see anything wrong with my posting, it's never been moaned
about before in the 14 years i've been on the internet - So frankly i don't

Usenet != Internet
care anymore, put me in your killfile if you want, as i think that anyone
who is childish enough to react like that over something so trivial is
pathetic so i don't think your replies would be of any use to me anyhow.

Your choice. I have explained these things to you with quite some patience
because I thought you were a promising poster. I was wrong.

Personally, I don't use killfiles. I'll remember this exchange without
one.
That and the fact i can't see anything wrong with the way i post, it's the
same as everyone else, everywhere else. But then again you alsways do have
the 'spoilt kid or the lick' trying to spoil anything anyone ever does.

It seems to be you who is applying for the part of "spoiled brat".
Some people should have never been givin the right to life.

Heavens! Who, did you say, was over-reacting?

Oh, and your spelling suffers when you are upset. Try a checker.

Anno

[more TOFU snipped]
 
D

D Borland

well if people had actualy just said that it was my quoting style that they
were upset with, rather than "top posting" which to me sounds totaly
un-related and didn't have a clue what you were talking about then i could
have sorted the problem and everyone would have been ok. Ok so i spell
wrong when i typing fast sometimes, but using "top posting" instead of
"quoting style" is the real problem here. And having read through the
posting guidelines, i notice the following :-

<extract>

A note to newsgroup "regulars":

Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume

</extract>

Oh, now there's something. So all these people who drop first-timers in
their kill file because of this (this and the fact they can't just say
"quoting style" rather than "top posting" which sounds nothing like what the
actualy problem is) are actualy not following the rules according to this
extract. So they inforce the bit they want and ignore everything else, so
who is the real problem here. It's obvious. It's those afore mentioned
regulares who dump first-timers who don't get the quoting style right into
their killfiles, as they have read the rules and choose to ignore what they
want and enfore what the dont.

Dagmar
 
J

Juha Laiho

D Borland said:
well if people had actualy just said that it was my quoting style that they
were upset with, rather than "top posting" which to me sounds totaly

No, quoting style is a different issue. Above you see one quoting style
(just > to indicate the part written by you), which more or less is the
preferred one.

:un-related and didn't have a clue what you were talking about then i could
:have sorted the problem and everyone would have been ok. Ok so i spell

This above would be another quoting style. At times you see quoting style
like the one below:

DB>wrong when i typing fast sometimes, but using "top posting" instead of
DB>"quoting style" is the real problem here. And having read through the
DB>posting guidelines, i notice the following :-
Oh, now there's something. So all these people who drop first-timers in
their kill file because of this (this and the fact they can't just say
"quoting style" rather than "top posting" [...]

It shouldn't be that hard to do a google search on "top posting" to
find f.ex. the ones below. Btw. please make your mind up whether you're
a first-timer or a veteran here (I recall seeing another message where
you said you've been around for more than 10 years, which wouldn't
make you a first-timer). But then, if you are a first-timer around,
then I guess I should understand you're not yet familiar with Google,
either. It is a very nice and easy-to-use information search engine
available at http://google.com/ .


Bottom vs. top posting and quotation style on Usenet
Bottom vs. top posting and quotation style on Usenet. This document
was ... as well. This can't at all be done in a top-posting. Also ...
www.cs.tut.fi/~jkorpela/usenet/brox.html - 6k - Cached - Similar pages

Why is Bottom-posting better than Top-posting
Why is Bottom-posting better than Top-posting. ... Top-posting:
Writing the message above
the original text, when one replies to an email or a post in a
newsgroup. ...

Top Posting
Top Posting. by David Stevenson, Liverpool, England, UK. ... The best
way is to answer
the post underneath as here. Top posting means putting the answer
first. ...
www.blakjak.demon.co.uk/gey_stv0.htm - 7k - Cached - Similar pages

The Absolute Beginners Guide to Usenet - FAQ - Top Posting
The Absolute Beginner's Guide to Usenet. Absolute Beginner's
Frequently
Asked Questions. 8. What is Top-Posting and why is it considered bad?
...
www.dickalba.demon.co.uk/usenet/guide/faq_topp.html - 8k - 23 Sep 2003
- Cached - Similar pages
 
S

Sam Holden

well if people had actualy just said that it was my quoting style that they
were upset with, rather than "top posting" which to me sounds totaly
un-related and didn't have a clue what you were talking about then i could
have sorted the problem and everyone would have been ok.

A google search is reasonable if you don't know a term, in this case it
provides numerous definitions of top posting - the first few *pages* of
results are all about the term.

Then of course there's the usenet FAQs and guides that you
are supposed to read *before* posting. It's mentioned in them too.

Do you often just invent meanings for terms you haven't come across
before? Life would probably be easier if you looked them up instead.
<extract>

A note to newsgroup "regulars":

Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume

</extract>

Oh, now there's something. So all these people who drop first-timers in
their kill file because of this (this and the fact they can't just say
"quoting style" rather than "top posting" which sounds nothing like what the
actualy problem is) are actualy not following the rules according to this
extract. So they inforce the bit they want and ignore everything else, so
who is the real problem here. It's obvious. It's those afore mentioned
regulares who dump first-timers who don't get the quoting style right into
their killfiles, as they have read the rules and choose to ignore what they
want and enfore what the dont.

Killfiling != flaming.

Being short != flaming.

Don't worry, I'm sure a large group of people have added you to their
killfiles after this exchange, and hence won't be bothering you
anymore. Note they did it silently instead of flaming about it.



--
 
D

D Borland

Btw. please make your mind up whether you're
a first-timer or a veteran here (I recall seeing another message where
you said you've been around for more than 10 years, which wouldn't
make you a first-timer). But then, if you are a first-timer around,
then I guess I should understand you're not yet familiar with Google,
either. It is a very nice and easy-to-use information search engine
available at http://google.com/ .

I did say that i had been using the internet for about 14 years - (well,
maybe not 14 more like 11 because for about the first 2/3 years i only used
bbs's which ain't really the internet) and my point of saying that was that
i've never come across this "top posting" farce before - "and that's the
truth".

That was my point.

I think i understand what you were all whining about now, and won't "top
post" or quote uneeded replies.

I think at this point, i'll take a deep breath and admit, that yes i've
probably been a bit of an idiot, and please accept my apologies to anyone i
may have offended through my postings - Sorry.

Dagmar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top