Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

nph-index.cgi run scheduled

Quote Reply
nph-index.cgi run scheduled
Hi

I want to run nph-index.cgi from cron however
if I run perl nph-index.cgi from the command line I get a message:
(offline mode: enter name=value pairs on standard input)

I was told to hit control d which then lets the script run (and fine it does) but I want to run this scheduled from crontab.

So 2 questions how do I get rid of this message which requires me to hit control d and also if I try to run the script anywhere outside the admin directory it can not find links.pm.

So in crontab I have a line:
00 14 * * * root /home/chilli/cgi-bin/links/admin/admin_index

and I have a file called "admin_index" in the admin directory with a line which says:

perl /home/chilli/cgi-bin/links/admin/nph-index.cgi

So is this not working because of the control d problem above or have I done this completely wrong.

Many Thanks

Tony

Quote Reply
Re: nph-index.cgi run scheduled In reply to
Why do you want to run nph-index.cgi?

If links are being added through the standard interfaces (admin and/or add.cgi) you don't need to. They are added/indexed properly.

You want to run nph_build.cgi to rebuild, and update the site stats on an automated process.

I removed the CGI lines from the index script, and you need to save this to a file like nph-index_telnet.cgi (it's not an nph file any more, but... )

Code:
#!/usr/bin/perl
# ==============================================================
# -------------
# Links SQL
# -------------
# Links Manager
#
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 1.1b3
#
# COPYRIGHT NOTICE:
#
# Copyright 1999 Gossamer Threads Inc. All Rights Reserved.
# No redistribution of this script may be made without prior
# written consent.
#
# By using this program you agree to indemnify Gossamer Threads
# Inc. from any liability.
#
# Please see the README for full license details.
#
# Modified to run via telnet, no CGI enabled.
#==============================================================

# Load required modules.
# ---------------------------------------------------
use Links;
use Links: BSQL;
use strict;
$| = 1;
my ($s, $e, $f, $in, $links, $cat, $total);

print "Links Manager: Indexing Links\n\n";

$s = time();

# Get our Links db object.
$links = new Links: BSQL "$LINKS{admin_root_path}/defs/Links.def";
$total = $links->total;

print qq|Indexing $total links. Started at |, scalar localtime($s), "\n";

$links->reindex_all();

# Reindex categories.
$cat = new Links: BSQL "$LINKS{admin_root_path}/defs/Category.def";
$total = $cat->total;

print qq|\n\nIndexing $total Categories. Started at |, scalar localtime($s), "\n";

$cat->reindex_all();

# All done.
$f = time();
$e = $f - $s;

print "\nDone ($e s)\n\n";

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: nph-index.cgi run scheduled In reply to
Actually if running from cron, the ctrl-d won't show up. Also, you can edit your scripts and right after

use CGI;

add:

$CGI::NO_DEBUG = 1;

and that won't show up anymore.

Cheers,

Alex