Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #256113

Re: auto restarting in crontab

From Greg Wooledge <greg@wooledge.org>
Newsgroups linux.debian.user
Subject Re: auto restarting in crontab
Date 2023-03-17 01:20 +0100
Message-ID <Ga5Z7-cZmg-1@gated-at.bofh.it> (permalink)
References (5 earlier) <G9VGp-cTbN-5@gated-at.bofh.it> <G9YEh-cUWG-5@gated-at.bofh.it> <G9ZK1-cVy1-1@gated-at.bofh.it> <Ga46Z-cYdP-3@gated-at.bofh.it> <Ga5Ps-cZjf-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Mar 17, 2023 at 08:04:24AM +0800, pyh@ymail.ne.jp wrote:
> Sometimes I was using the older ruby version (1.x), but sometimes I am using
> the latest ruby (3.x). For example, different streaming libraries for ruby
> require different versions.
> 
> For instance, I developed a ruby client for Kafka streaming, and deployed it
> in crontab, and this script must use ruby 3.x version.
> 
> 0 * * * * ruby kafka-consumer.rb

How is cron going to know which ruby to use?  Cron uses a very minimalist
PATH.  From crontab(5):

       Several environment variables are set up automatically by  the  cron(8)
       daemon.  SHELL is set to /bin/sh, and LOGNAME and HOME are set from the
       /etc/passwd  line  of  the   crontab's   owner.    PATH   is   set   to
       "/usr/bin:/bin".   HOME,  SHELL, and PATH may be overridden by settings
       in the crontab; LOGNAME is the user that the job is running  from,  and
       may not be changed.

Cron is going to look for /usr/bin/ruby or /bin/ruby and that's it,
unless there's more to this crontab that you haven't shown us.

If you need your crontab to use a specific version of ruby, on a system
with multiple versions installed, you need to use the full path to one
of them, or set the PATH variable.

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

auto restarting in crontab coreyh@free.fr - 2023-03-16 02:00 +0100
  Re: auto restarting in crontab Nicholas Geovanis <nickgeovanis@gmail.com> - 2023-03-16 02:10 +0100
    Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-16 02:40 +0100
      Re: auto restarting in crontab coreyh@free.fr - 2023-03-16 02:50 +0100
        Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-16 04:20 +0100
          Re: auto restarting in crontab coreyh@free.fr - 2023-03-16 07:30 +0100
        Re: auto restarting in crontab "pyh@ymail.ne.jp" <pyh@ymail.ne.jp> - 2023-03-16 05:00 +0100
          Re: auto restarting in crontab "pyh@ymail.ne.jp" <pyh@ymail.ne.jp> - 2023-03-16 05:10 +0100
            Re: auto restarting in crontab Jeremy Ardley <jeremy@ardley.org> - 2023-03-16 06:00 +0100
  Re: auto restarting in crontab Nicolas George <george@nsup.org> - 2023-03-16 09:00 +0100
    Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-16 12:10 +0100
      Re: auto restarting in crontab Nicolas George <george@nsup.org> - 2023-03-16 12:10 +0100
  Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-16 12:30 +0100
    Re: auto restarting in crontab Christoph Brinkhaus <c.brinkhaus@t-online.de> - 2023-03-16 14:00 +0100
      Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-16 14:10 +0100
        Re: auto restarting in crontab Nicolas George <george@nsup.org> - 2023-03-16 14:20 +0100
          Re: Re: auto restarting in crontab pyh@ymail.ne.jp - 2023-03-16 17:30 +0100
            Re: auto restarting in crontab Dan Ritter <dsr@randomstring.org> - 2023-03-16 18:40 +0100
              Re: auto restarting in crontab Jude DaShiell <jdashiel@panix.com> - 2023-03-16 19:00 +0100
              Re: auto restarting in crontab debian-user@howorth.org.uk - 2023-03-16 23:20 +0100
                Re: auto restarting in crontab Dan Ritter <dsr@randomstring.org> - 2023-03-17 00:10 +0100
                Re: auto restarting in crontab Jeffrey Walton <noloader@gmail.com> - 2023-03-17 00:40 +0100
                Re: auto restarting in crontab Nicolas George <george@nsup.org> - 2023-03-17 13:20 +0100
                Re: auto restarting in crontab debian-user@howorth.org.uk - 2023-03-17 13:20 +0100
                Re: auto restarting in crontab "pyh@ymail.ne.jp" <pyh@ymail.ne.jp> - 2023-03-17 01:10 +0100
                Re: auto restarting in crontab Greg Wooledge <greg@wooledge.org> - 2023-03-17 01:20 +0100
                Re: auto restarting in crontab debian-user@howorth.org.uk - 2023-03-17 13:30 +0100
  Re: auto restarting in crontab Christoph Brinkhaus <c.brinkhaus@t-online.de> - 2023-03-16 12:30 +0100

csiph-web