Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Dummy qn but is this right? > abt crontab

(Page 1 of 2)
> >
Quote Reply
Dummy qn but is this right? > abt crontab
I tried to use crontab to build links to no avail...
I think it could be a problem with my paths...

build_links.sh
In Reply To:
# Rebuild Links pages and log actions
/home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi > /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/logs/build_links.log
I chmmod it and upload to '/home/lazyjuice/'
when I typed pwd... it also gives the above path.

mycron.txt
In Reply To:
# (Re)Build the Links HTML Files Every 6 Hours at 1/7 a.m. and p.m.
0 1,7,13,19 * * * /home/lazyjuice/build_links.sh
after uploading to same dir as build_links.sh i went telnet and type crontab mycron.txt

it is loaded cos when i see crontab -l, the event shows up. Yet nothing happens when the hr pass... even when i left it for a day... nothing happens...

my mycron.txt and build_links.sh are in the dir i see when i first telnet in... which is the '/home/lazyjuice' when i type pwd. can anybody explain? There is nothing the the logs dir i created...

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
The .sh file should be chmod 744.

And you are not using the complete FULL PATH in the crontab entry...you need to use:

Code:

# (Re)Build the Links HTML Files Every 6 Hours at 1/7 a.m. and p.m.
0 1,7,13,19 * * * /home/lazyjuice/home/lazyjuice/htdocs/build_links.sh


In order to improve your success with applying Mods, I would recommend learning basic principles of CGI/Perl programming, like the difference between relative and full paths.

Buy Perl for Dummies or CGI for Dummies.


Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
In Reply To:
# (Re)Build the Links HTML Files Every 6 Hours at 1/7 a.m. and p.m.0 1,7,13,19 * * * /home/lazyjuice/home/lazyjuice/htdocs/build_links.sh
i see '/home/lazyjuice' in the same line twice... is that correct?

in addition... my build_links.sh is upload in the dir b4 htdocs... not in the same dir as index.html... which you can view just by typing www.lazyjuice.com

to prove my point, let say i use telnet and go to the same dir as where my build_links.sh is located.. and i type 'pwd'... it gives me /home/lazyjuice...

and i did chmod to the correct permission.

did i get anything wrong? pls help a dummy....

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
No...that is not correct. Putting the codes on the same line will NOT work, because you have put the crontab codes in the REM comment line....

You need to use the following:

In Reply To:

# (Re)Build the Links HTML Files Every 6 Hours at 1/7 a.m. and p.m.
0 1,7,13,19 * * * /home/lazyjuice/htdocs/build_links.sh


Got it?

And you need to be clear about what paths you are going to use...if you get stuck, refer to your hosting company's online documentation...they should have some for custom CGI/Perl scripts.

because it definitely seems that you are confusing FULL paths...and the FULL PATH you need to use is the one that you put in the links.cfg file!

Also, try using dir in the directory/folder where your shell files are located.

Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Here is an extract from my links.cfg

In Reply To:
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/home/lazyjuice/htdocs/cgi-bin/searchsg/admin";
$db_dir_url = "http://www.lazyjuice.com/cgi-bin/searchsg/admin";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http://www.lazyjuice.com/cgi-bin/searchsg";

# PATH and URL of Pages to be built. No Trailing Slash.
$build_root_path = "/home/lazyjuice/htdocs/searchsg";
$build_root_url = "http://www.lazyjuice.com/searchsg";
in any case... i didn't use /home/lazyjuice/home/lazyjuice/htdocs...

ohhhhhh nooooo i am reallly confused abt all my paths...

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Please refer to my EDITED REPLY above...

You only need to use:

Code:

/home/lazyjuice/htdocs/


ONCE...


Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Qn...

i really dun understand y i must use /htdocs when the build_links is not even in dat dir...

here is an screenshot of my telnet to show u wat i mean
http://www.lazyjuice.com/downloads/telnet.gif

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Meanwhile... how much it cost to buy a dummy book.. perhaps i need a duummy book to teach me to use a dummy book! Cheers... Smile



Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
BECAUSE your FULL PATH shows up as:

[/home/lazyjuice/htdocs/]

LOOK again at the [path] line when you type in pwd.

And from the looks of it, your shell files are not even in the htdocs directory (which seems to be your ROOT directory). If you have the shell files below your ROOT directory (without htdocs), then you don't need to put in htdocs.

But what I would do is the following:

1) Move all the SHELL files into your htdocs folder.
2) Change the permission of the SHELL files to 744.
3) Then edit your CRONTAB entries to include the htdocs.

got it???

Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Hmmm think i got it...

anyway... i made the modifications and think it is time to sleep..... ZZZZZzzzzzzzzzzz My time is SG is 4:25am... and i shall find out by 7am whether it worked... (Note : I know i can set the time to 4.30 or watever... but if it does not work, i ain't able to sleep... so... nite nite.)

Wat is the time over there?


Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
14:40 (2:40 p.m.) MST

And hopefully it will work.

Also, you can search for Dummy books at AMAZON.COM or other online book stores.

Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
i woke up feeling excited and went to se my links. Refreshed it and the last updated date & time is by me.

Here is another screenshot... shucks i really dun know wat to do next...

http://www.lazyjuice.com/downloads/telnet2.gif

somebody heeeeeeeeeeeelllllllllllpppp

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Try,

mycron.txt

0 1 * * * /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi
0 7 * * * /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi
0 13 * * * /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi
0 19 * * * /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi

Then upload, and in that directory you uploaded to type crontab mycron.txt (in telnet, obviously).

Then, type crontab -l to see if it has been updated.

NOTE: In mycron.txt make sure you press 'enter' at the end of the last line, otherwise this can cause it not to work Wink

Hope that helps. I never really had any luck with .sh files, so I just stuck to executing the .cgi files!

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
signz.. it didn't work... how? can anybody help?

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Does your hosting company have any online documentation about "automating scripts" or tutorials on Crontab???

The problem could stem from a different Cron Daemon configuration that will not allow the typical .sh execution to occur. I would highly recommend searching your hosting company's online tutorials for Crontab or contact your sysadmin for assistance...because we have provided you all the advice taken from Bobsie's wonderful Crontab tutorial and none of our suggestions are helping you.

I, for one, have nothing more to contribute to this Thread.

Bye!

Regards,

Eliot Lee
Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
ok... i shall contact my hosting company... i be back to give u guys good new... hopefully...

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Okay... my webhosting company says my crontab is running fine. According to the logs, it did execute the processes at the stimpulated timings. He asked me to run build_links.sh myself. This brings me to the next question, how do i run build_links.sh from telnet? How do i run nph0build.cgi from telnet?

My build_links has an extra line '#!/bin/sh' at the top... will this line affect any process?

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
wait wait......

when i typed 'perl nph-build.cgi' it says 'You can't run this script from telnet/shell. So anybody can explain wat this means?

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
It means you can't run the file from telnet but you should be able to - I was running nph-build using telnet yesterday.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Err... so u are saying i can't run np3-build from telnet or is it everybody who also cannot do so?

Is the command right? "perl nph-build.cgi"

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
What I am saying is you should be able to as I was doing it only yesterday.

Yes perl nph-build.cgi is correct if you are in the admin directory otherwise you need to use...

perl /path/to/nph-build.cgi

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
I know this has been discussed before but just try this one last time:

Make a new file called build_cron.txt and put this in it:

1 0 * * * /PATH/TO/nph-build.cgi >> /PATH/TO/build.log 2>&1

...obviously change /PATH/TO/ to the correct path to nph-build on your server.

Upload the file to your server, for example your admin diectory. Then login to your site using telnet/ssh and use cd to move to the admin directory or wherever you put the txt file.

cd /path/to/build_cron.txt

Then type

crontab build_cron.txt

That should set up the cronjob

Then type crontab -l to make sure it has worked.

That code I gave will run nph-build.cgi every day at 12.01am

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
contents of cronjob.txt

In Reply To:
0 1,7,13,19 * * * /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/nph-build.cgi >> /home/lazyjuice/htdocs/cgi-bin/searchsg/admin/logs/build.log 2>&1
nothing happened. My webhosting company asked me to put '#!/bin/sh' as the first line for my build_links.sh. Must i also do that for cronjob.txt

i cannot run 'perl nph-build.cgi'... does that mean my nph is corrected??? last time... to make my nph-build work instead of see internal server errors... i add comment tag to 'nph++'. Does tis have any effect on anything?

Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
Try to issue the cron command once again: crontab mycron.txt
I believe it will work. If you have problems working out your path - download a path finder from the following site:
http://www.dotmatrix.net/scripts/setup/tester.zip

You upload the file to your cgi-bin and execute it by using your browser; it will tell you the correct path.

After you correct the path you have to issue the cron command as outlined earlier on.

Joe



Quote Reply
Re: Dummy qn but is this right? > abt crontab In reply to
i am veri sure my path is not wrong... my webhosting company says... (when i asked them to setup crontab and load build_link.sh) the crontab did run at the timing...
could it be something wif the nph-build.cgi cos when i type 'perl nph-build.cgi' during telnet... it cannot work.



> >