Loading ...
Sorry, an error occurred while loading the content.

Re: [irlp-embedded] crontab not sourcing repeater environment

Expand Messages
  • John Williams - VK5ZY
    Thanks Dave,I do the the same in my custom scripts, but generally wrap it in an if blockif [ $RUN_ENV != TRUE ] ; then .
    Message 1 of 3 , Oct 17, 2011
    • 0 Attachment
      Thanks Dave,

      I do the the same in my custom scripts, but generally wrap it in an if block

      if [ "$RUN_ENV" != "TRUE" ] ; then
      . /home/irlp/custom/environment
      fi

      Looks like I have been caught out by the differences in my distro RH9.0 and the Slackware distro.

      Proves that you are never too old to learn no matter how experienced you might be with an OS.

      Calling connect_to_reflector directly from custom.crons does work on a RH9.0 box.

      At least now it has been talked about a bit more on this list.

      Thanks again.

      Cheers

      John
      VK5ZY


      On 17 Oct 2011 at 8:57, David Cameron (IRLP) wrote:

      >
      >
      > Any script I add to a crontab, I have call the environment file, do what
      > I want it to, and then exit. This is for embedded nodes or not.
      >
      > Since crontabs operate differently for almost every OS, that is the one
      > sure-fire way to make it work correctly.
      >
      > I would make a script called "call_9501", and then call it from the crontab.
      >
      > #!/bin/bash
      > . /home/irlp/custom/environment
      > $SCRIPT/connect_to_reflector ref9501 >/dev/null 2>&1
      > exit 0
      >
      > Your custom.crons entry would be:
      > 29 08 * * * /home/irlp/custom/call_9501
      >
      > That way you can source the environment file, set the timeout, etc.
      >
      > This has been talked about a lot in the IRLP Yahoogroup list, not as
      > much here.
      >
      > Dave Cameron
      > VE7LTD
      >
      > On 16/10/2011 9:44 PM, John Williams - VK5ZY wrote:
      > > Have searched this question within the group without any result. If it has been addressed please refer me
      > to the relevant
      > > message.
      > >
      > > I have been asked by two node owners to create a simple custom.crons entry to connect to a reflector.
      > > Easy, I have done this on my non embedded node.
      > >
      > > This works on my non embedded node.
      > > 29 08 * * * /home/irlp/scripts/connect_to_reflector ref9501> /dev/null 2>&1
      > >
      > > Did not work on the embedded nodes.
      > >
      > >> From the command line
      > > /home/irlp/scripts/connect_to_reflector ref9501> /dev/null 2>&1
      > > works fine.
      > >
      > > So I redirected the output from the cronjob to a file and this contained
      > > echo "You must source the environment file first. Do this by running:"
      > > echo ". /home/irlp/custom/environment"
      > >
      > > I believe this exception was being caught in common-functions.sh
      > >
      > > The setting of the variables in crontab look fine
      > > SHELL=/bin/bash
      > > TERM=xterm
      > > BASH_ENV=/home/irlp/.profile
      > >
      > > .profile file looks fine as well.
      > >
      > > Adding these cron jobs to my non embedded node produces the expected output
      > > */2 * * * * echo $BASH_ENV> /home/irlp/custom/batest
      > > */2 * * * * echo $RUN_ENV> /home/irlp/custom/runenvtest
      > >
      > > On the embedded nodes the files are empty.
      > >
      > > As a further test I called the connect_to_reflector script via another script being called from custom.crons
      > > which included the following test.
      > >
      > > if [ "$RUN_ENV" != "TRUE" ] ; then
      > > . /home/irlp/custom/environment
      > > fi
      > >
      > > The connect_to_reflector script the ran as it should.
      > >
      > > As a work around I changed the line in custom.crons in the embedded nodes to
      > > 29 08 * * * . ~/.profile; /home/irlp/scripts/connect_to_reflector ref9501> /dev/null 2>&1
      > >
      > > Of course I could have probably source the environment directly within custom.crons.
      > >
      > > Anyone else noticed this or I am just unlucky.
      > >
      > > Cheers
      > >
      > > John
      > > VK5ZY
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > > -----
      > > No virus found in this message.
      > > Checked by AVG - www.avg.com
      > > Version: 10.0.1411 / Virus Database: 1522/3952 - Release Date: 10/14/11
      > >
      > >
      >
      >




      -----
      No virus found in this message.
      Checked by AVG - www.avg.com
      Version: 10.0.1411 / Virus Database: 1522/3956 - Release Date: 10/16/11
    Your message has been successfully submitted and would be delivered to recipients shortly.