PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > cannot execute ruby files without wrapper in a cron
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
cannot execute ruby files without wrapper in a cron

Réponse
 
LinkBack Outils de la discussion
Vieux 06/01/2008, 21h28   #1
Junkone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut cannot execute ruby files without wrapper in a cron

whenever i try to execute a ruby file thro cron, i have to write a
crapper to cd the folder of the ruby file and then execute it. it is
such a hassle. what are the alternatives so that i dont have to write
a wrapper. the prob that i get if i run them directly is that it tries
to run in the same directory of the cron and cannot find the local
libraries that my require statments have. how can i get ruby to
execute the rb file in a specific directory. or is there any other
option.

RUBY E:\TradingTools\CODE\ABScans.rb
e:/ruby/lib/ruby/site_ruby/1.8/xmlconfigfile.rb:646: warning:
parenthesize argum
ent(s) for future version
e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_re
quire': no such file to load -- sendGmail (LoadError)
from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `re
quire'
from E:/TradingTools/CODE/ABScans.rb:3

  Réponse avec citation
Vieux 06/01/2008, 22h16   #2
Robert Dober
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cannot execute ruby files without wrapper in a cron

On Jan 6, 2008 10:29 PM, Junkone <junkone1@gmail.com> wrote:
> whenever i try to execute a ruby file thro cron, i have to write a
> crapper to cd the folder of the ruby file and then execute it. it is
> such a hassle. what are the alternatives so that i dont have to write
> a wrapper. the prob that i get if i run them directly is that it tries
> to run in the same directory of the cron and cannot find the local
> libraries that my require statments have. how can i get ruby to
> execute the rb file in a specific directory. or is there any other
> option.
>
> RUBY E:\TradingTools\CODE\ABScans.rb
> e:/ruby/lib/ruby/site_ruby/1.8/xmlconfigfile.rb:646: warning:
> parenthesize argum
> ent(s) for future version
> e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_re
> quire': no such file to load -- sendGmail (LoadError)
> from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> 27:in `re
> quire'
> from E:/TradingTools/CODE/ABScans.rb:3
>
>
>


571/72 > ruby -h
Usage: ruby [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
-a autosplit mode with -n or -p (splits $_ into $F)
-c check syntax only
-Cdirectory cd to directory, before executing your script
-d set debugging flags (set $DEBUG to true)
-e 'command' one line of script. Several -e's allowed. Omit [programfile]
-Fpattern split() pattern for autosplit (-a)
-i[extension] edit ARGV files in place (make backup if extension supplied)
-Idirectory specify $LOAD_PATH directory (may be used more than once)
-Kkcode specifies KANJI (Japanese) code-set
-l enable line ending processing
-n assume 'while gets(); ... end' loop around your script
-p assume loop like -n but print line also like sed
-rlibrary require the library, before executing your script
-s enable some switch parsing for switches after script name
-S look for the script using PATH environment variable
-T[level] turn on tainting checks
-v print version number, then turn on verbose mode
-w turn warnings on for your script
-W[level] set warning level; 0=silence, 1=medium, 2=verbose (default)
-x[directory] strip off text before #!ruby line and perhaps cd to directory
--copyright print the copyright
--version print the version

I guess the -I (that is "i".upcase) is the option you need, AAMOF cron
jobs are not exactly executed as in a login shell, I ignore(1) the
details, but man cron will explain this in detail.
Just for curiosity, which cron are you using and in which context (cygwin?).

HTH
Robert
(1) keep forgetting them is more precise

--
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein

  Réponse avec citation
Vieux 06/01/2008, 23h55   #3
Junkone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cannot execute ruby files without wrapper in a cron

On Jan 6, 5:16pm, Robert Dober <robert.do...@gmail.com> wrote:
> On Jan 6, 2008 10:29 PM, Junkone <junko...@gmail.com> wrote:
>
>
>
>
>
> > whenever i try to execute a ruby file thro cron, i have to write a
> > crapper to cd the folder of the ruby file and then execute it. it is
> > such a hassle. what are the alternatives so that i dont have to write
> > a wrapper. the prob that i get if i run them directly is that it tries
> > to run in the same directory of the cron and cannot find the local
> > libraries that my require statments have. how can i get ruby to
> > execute the rb file in a specific directory. or is there any other
> > option.

>
> > RUBY E:\TradingTools\CODE\ABScans.rb
> > e:/ruby/lib/ruby/site_ruby/1.8/xmlconfigfile.rb:646: warning:
> > parenthesize argum
> > ent(s) for future version
> > e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > `gem_original_re
> > quire': no such file to load -- sendGmail (LoadError)
> > from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > 27:in `re
> > quire'
> > from E:/TradingTools/CODE/ABScans.rb:3

>
> 571/72 > ruby -h
> Usage: ruby [switches] [--] [programfile] [arguments]
> -0[octal] specify record separator (\0, if no argument)
> -a autosplit mode with -n or -p (splits $_ into $F)
> -c check syntax only
> -Cdirectory cd to directory, before executing your script
> -d set debugging flags (set $DEBUG to true)
> -e 'command' one line of script. Several -e's allowed. Omit [programfile]
> -Fpattern split() pattern for autosplit (-a)
> -i[extension] edit ARGV files in place (make backup if extension supplied)
> -Idirectory specify $LOAD_PATH directory (may be used more than once)
> -Kkcode specifies KANJI (Japanese) code-set
> -l enable line ending processing
> -n assume 'while gets(); ... end' loop around your script
> -p assume loop like -n but print line also like sed
> -rlibrary require the library, before executing your script
> -s enable some switch parsing for switches after script name
> -S look for the script using PATH environment variable
> -T[level] turn on tainting checks
> -v print version number, then turn on verbose mode
> -w turn warnings on for your script
> -W[level] set warning level; 0=silence, 1=medium, 2=verbose (default)
> -x[directory] strip off text before #!ruby line and perhaps cd to directory
> --copyright print the copyright
> --version print the version
>
> I guess the -I (that is "i".upcase) is the option you need, AAMOF cron
> jobs are not exactly executed as in a login shell, I ignore(1) the
> details, but man cron will explain this in detail.
> Just for curiosity, which cron are you using and in which context (cygwin?).
>
> HTH
> Robert
> (1) keep forgetting them is more precise
>
> --http://ruby-smalltalk.blogspot.com/
>
> ---
> Whereof one cannot speak, thereof one must be silent.
> Ludwig Wittgenstein- Hide quoted text -
>
> - Show quoted text -


I am using python cron on windows and -I is just what the doc
prescribed. its works beautifully.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h46.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11501 seconds with 11 queries