I have a ruby script that I am trying to set up on a cronjob. I have
tested it both just running it in the normal mode and a test shell mode.
When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
environments. Could someone help point me out what I am doing wrong?
Have you tried giving the full path to Ruby? /usr/local/bin/ruby or
whatever it is on your machine?
···
On 4 September 2013 14:41, Paul Darragh <lists@ruby-forum.com> wrote:
I have a ruby script that I am trying to set up on a cronjob. I have
tested it both just running it in the normal mode and a test shell mode.
When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
environments. Could someone help point me out what I am doing wrong?
To make sure it is not an issue with the PATH environment variable
(cron may have its own?), try invoking Ruby with the full path,
e.g. /usr/bin/ruby (you can find out with 'which ruby').
Regards,
Marcus
···
Am 04.09.2013 15:41, schrieb Paul Darragh:
I have a ruby script that I am trying to set up on a cronjob. I have
tested it both just running it in the normal mode and a test shell mode.
When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
environments. Could someone help point me out what I am doing wrong?
I have tried to give it the specific Path to ruby and loadingin the path
from the profile I am using. It is still not working only when I run it
as a cronjob.
I have a ruby script that I am trying to set up on a cronjob. I have
tested it both just running it in the normal mode and a test shell mode.
When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
environments. Could someone help point me out what I am doing wrong?
On 4 Σεπ 2013, at 15:41 , Paul Darragh <lists@ruby-forum.com> wrote:
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."
cron uses a very minimal path.
you may need to explicitely set the PATH at the top of your crontab, or
give the full path to any exes that you utilize
···
On Wed, 2013-09-04 at 16:13 +0200, sto.mar@web.de wrote:
Am 04.09.2013 15:41, schrieb Paul Darragh:
> I have a ruby script that I am trying to set up on a cronjob. I have
> tested it both just running it in the normal mode and a test shell mode.
>
> When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
> run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
> environments. Could someone help point me out what I am doing wrong?
>
> My crontab looks like this:
>
> * * * * * ruby /home/salinn/dev/ruby/webmail/script.rb
To make sure it is not an issue with the PATH environment variable
(cron may have its own?), try invoking Ruby with the full path,
e.g. /usr/bin/ruby (you can find out with 'which ruby').
On Wed, 2013-09-04 at 18:54 +0200, Paul Darragh wrote:
I have tried to give it the specific Path to ruby and loadingin the path
from the profile I am using. It is still not working only when I run it
as a cronjob.
On Wed, 2013-09-04 at 21:00 +0200, Panagiotis Atmatzidis wrote:
Hello,
On 4 Σεπ 2013, at 15:41 , Paul Darragh <lists@ruby-forum.com> wrote:
> I have a ruby script that I am trying to set up on a cronjob. I have
> tested it both just running it in the normal mode and a test shell mode.
>
> When I am logged in as a normal user or in 'env -i $SHELL --norc' I will
> run ruby /home/salinn/dev/ruby/webmail/script.rb and it works in both
> environments. Could someone help point me out what I am doing wrong?
>
> My crontab looks like this:
>
> * * * * * ruby /home/salinn/dev/ruby/webmail/script.rb
>
> --
> Posted via http://www.ruby-forum.com/\.
This was my crontab at a Gentoo system with fcron (a more powerful solution than cron) but same works for other systems
email: atma@convalesco.org
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."
###############################################################################
#
lclcmd=`basename $0`
#
if [ "$1" = "-h" ]; then
Description
fi
minargv=1
if [ $# -lt $minargv ]; then
echo "Invalid number of parameters specified."
Description
fi
#
###############################################################################
# set up some standard variables
###############################################################################
#
exitsts=0
#
###############################################################################
# validate parameters
###############################################################################
#
# N/A
#
###############################################################################
# run the job
###############################################################################
#
cd /home/${user}
. /home/${user}/.profile
envfile=`/usr/local/rvm/bin/rvm env --path`
. $envfile
#
$*
cmdsts=$?
if [ $cmdsts -ne 0 ]; then
exitsts=1
echo "cronit: ERROR"
echo "quitting $lclcmd"; exit $exitsts
fi
#
exit $exitsts
--
If you have received the message in error, please advise the sender by
reply email and please delete the message. This message contains
information which may be confidential or otherwise protected. Unless
you are the addressee (or authorized to receive for the addressee), you
may not use, copy, or disclose to anyone the message or any information
contained in the message.
"It isn't working" isn't really very descriptive. What errors are you getting?
···
On Sep 4, 2013, at 11:54 AM, Paul Darragh <lists@ruby-forum.com> wrote:
I have tried to give it the specific Path to ruby and loadingin the path
from the profile I am using. It is still not working only when I run it
as a cronjob.
to see the environment your cronjob is actually running in. After that cronjob runs, the file should appear in your home directory. You can remove the cronjob after that. Inspect the environment, see if there's anything missing you need.
···
On Sep 5, 2013, at 7:26 AM, Paul Darragh <lists@ruby-forum.com> wrote:
tamouse m. wrote in post #1120716:
On Sep 4, 2013, at 11:54 AM, Paul Darragh <lists@ruby-forum.com> wrote: