Forum Moderators: bakedjake

Message Too Old, No Replies

Cron job

Synthax

         

specter

10:07 pm on Oct 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Not sure I posted right.

Anyway,please,I need your help:I have to set up a cronjob on my server.I have a .cgi script to execute on a regular basis.My server has a front-end panel where to choose comfortably the timing avoiding to enter specific Unix synthax, but requires however to enter the command row:
What could it be?
I tried the path to the script in various ways, such as

/usr/local/script.cgi

but nothing happens

The output sent me via mail said "No such file/directory"...

What can I do?

This is driving me crazy!

Please,help me, I never had to do with such an issue before now...

Thanks in advance

Sincerely

jtara

4:12 am on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't run a CGI script from the command line.

What they probably want you to do is to fetch a particular page (that will invoke the CGI script) from your website.

You will need to install a command-line HTTP-access tool in order to do this. For example, "wget".

I just came across this myself. The Drupal CMS requires that a CGI script be accessed periodically via a cron job.

There's a good explanation of this at the Drupal site:

[drupal.org...]

BTW, the default .htaccess file for Drupal permits access to the "cron" URL only from the local host, to prevent abuse.

specter

5:29 pm on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well,

not helpful for me...

I need step by step instructions...

jtara

7:17 pm on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The link in my response gives step by step instructions.

Granted, they are for Drupal. But, without knowing your exact details, it's hard to get more specific.

Follow the instructions on that page. Just substitute your domain for "example.com", and the full path of your cgi script for "cron.php".

rocknbil

10:38 am on Oct 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



requires however to enter the command row:
What could it be?
I tried the path to the script in various ways, such as
/usr/local/script.cgi

Unless your script is actually located in the /usr/local directory, that would have to be incorrect. I think by command row you mean full path or virtual path to the script from the machine root.

Put this in a plain text file with a .cgi or .pl extension (whatever runs on your server,) chmod it to 755, and run it from a browser:

#!/usr/bin/perl

## The previous line may need to be changed to wherever perl lives

print "content-type:text/html\n\n";
foreach $v (sort keys %ENV) {
print "$v : $ENV{$v} <br>\n";
}

## End of script

Among the environment variables will be one named DOCUMENT_ROOT. This is the machine's path to your domain, for example,

/virtuals/www/example.com

so if the script is in cgi or cgi-bin,

/virtuals/www/example.com/cgi-bin/yourscript.cgi

would be the "command line" for your cron or crontab job.

After collecting your environment variables, delete this script from your server, you don't want it where someone can stumble on it.