Re: What is "return code" for WAL send command

From: David W Noon <dwnoon(at)ntlworld(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: What is "return code" for WAL send command
Date: 2010-10-25 11:19:10
Message-ID: 20101025121910.48804197@memphis.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 25 Oct 2010 09:49:02 +0200, Fredric Fredricson wrote abour Re:
[GENERAL] What is "return code" for WAL send command:

> On 10/23/2010 02:01 PM, zhong ming wu wrote:
[snip]
>> For some reason it failed recently with "return codes 32512" and I
>> couldn't find this num. as a valid rsync exit code
>>
>> During the time that the error was going on I tried the rsync
>> command manually and didn't error
>>
>I guess you have fallen into the common pitfall that cron does not
>read bash ini files and does not set the $PATH variable. If you want
>your scripts to be run by cron you must make them independent of $PATH
>and other variables set by .bashrc etc.

One can also specify environment variables at the top of the crontab.
This overcomes the issue of cron jobs not reading /etc/profile and
other start-up scripts that are processed by a normal login shell. For
example, here is my personal crontab:

# Establish environment variables.
JAVA_HOME='/etc/java-config-2/current-system-vm'
PATH="/home/dwn/bin:/usr/local/bin:/bin:/usr/bin:/opt/bin:/etc/java-config-2/current-system-vm/bin:/etc/java-config-2/current-system-vm/jre/bin"
TMPDIR='/tmp'
HOME='/home/dwn'
SHELL='/bin/zsh'
LOGNAME='dwn'
LC_ALL='en_GB.UTF-8'
http_proxy='http://webproxy.local:8080'
ftp_proxy='http://webproxy.local:8080'
RSYNC_PROXY='webproxy.local:8080'
CC='gcc'
CXX='g++'

# Set our priority level.
!nice(4)

# Each morning run a scan of our home directory for backup files.
%daily 30 20 find "$HOME/" \( -name \*~ -o -iname \*.bak \) -print
- -delete

# Clean out the work directory for Lazarus.
%daily 18 05 cd "$HOME/Lazarus_projects/tmp/" && for fn in *(N); do rm
- -rf "$fn"; done

# Clean out the cache subdirectories under $HOME.
%daily 28 07 cache_clean.zsh

As you can see, it establishes all the most common environment variables
before any cron job starts.
- --
Regards,

Dave [RLU #314465]
======================================================================
dwnoon(at)ntlworld(dot)com (David W Noon)
======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAkzFZ7QACgkQRQ2Fs59Psv/JBwCeKRUID/cE4roMbduG2I345evk
hiwAn3ohd2+2FxkVEwkeVuV/Q6eJpixd
=w68f
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Gould 2010-10-25 12:12:58 Re: Missing uuid_generate_v1()
Previous Message Fredric Fredricson 2010-10-25 07:49:02 Re: What is "return code" for WAL send command