Gerhard Niklasch on Thu, 1 Feb 2001 13:19:26 +0100 (MET)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Arguments

In response to:
> Message-Id: <>
> Date: Thu, 1 Feb 2001 12:21:14 +0100 (MET)
> From: Olivier Ramare <>
>   I want to run the program "" (one of my own) in a cron job.
> My favorite instruction is thus essentially
> gp <
> How can I send parameters with my script ?
> There's a solution :
> cat | gp
> I would like to know if I can send parameters directly.

The above is not a bad solution.  There are several variations
on this theme --most boil down to a little shell (or perl, or
whatever your preferred general UNIX interpreter is) scripting,
a few can be done in "pure gp".

* write a script which feeds a file followed by some of its
  own commandline args into gp
  (hint: you can do wonderful things with subshells, in
  particular, you can chain the output of several sequential
  commands together and redirect them all in one go into a

* write a script which generates everything on the fly and
  pipes it into gp  (I have done this often, usually with perl)

* use perl and Ilya's Math::Pari module

* write short gp driver scripts, one per job, which \r the
  common function definitions  (I have also done this often).
  Of course you would not enter those scripts into your crontab -
  you could control them as batch jobs using the at command,
  or invent a method of spooling them into a directory and
  have your cronjob pick them up from this queue

* write a daemon and have your cronjob script retrieve the
  current task parameters from the daemon through a network
  connection, using whatever protocol is convenient  (exotic
  but feasible!)

* have gp interrogate some external source of data, using
  \r (from a named pipe, say...), or extern()

* anything else I can't think of off the top of my head...

Enjoy, Gerhard