unable to print capistrano deployment log into an file

285 views
Skip to first unread message

sudha...@expertus.com

unread,
Feb 24, 2015, 6:43:37 AM2/24/15
to capis...@googlegroups.com

Hi All ,
Im new to this capistrano , rails project .

I have one issue . while deploy rails code with capistrano i can able to see the logs in terminal .
But unable to print into a file ...

i have tried linux native method

cmd > output.log not working
cmd 2>&1 | tee also not working...

Which is the best way to capture capistrano stadard output & error redirect into an file

Thanks in advance .



ruby version = ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
cap version = Capistrano Version: 3.3.5 (Rake Version: 10.4.2)
os -= centos 6.5 64bit
gem version = 2.4.5






Versions:
  • Ruby
  • Capistrano
  • Rake / Rails / etc
Platform:
  • Working on....
  • Deploying to...
Logs:
  • Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)
Files:
  • Capfile
  • deploy.rb
  • Stage files (production.rb, staging.rb)

Lee Hambley

unread,
Feb 24, 2015, 7:39:04 AM2/24/15
to Capistrano

What command?

Sent from my Nexus 5.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/1f376041-1128-49dc-b768-040416ece570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

junior

unread,
Feb 24, 2015, 7:43:45 AM2/24/15
to capis...@googlegroups.com
Hi Lee,
                have attached my shell script & capistrano output in terminal 

shell script start 
#!/bin/bash

main()
{
setupenv
archivelogs
printenv
        echo -e "\033[104m Server: \033[1m `hostname` \033[21m"
        echo -e " Environment: \033[1m $capenv \033[21m \033[0m"
        echo -e "\033[7m Please verify the values above. \033[5m [Enter to Continue]\033[0m"
        read 
# warnenv

read -p "Ready to run task $captask [yY]? " readytorun
if [ x$readytorun = 'xy' -o x$readytorun = 'xY' ]
then
echo Running cap $capenv $captask ..
runcaptask $capenv $captask
else
echo Come back when ready..
fi
}

archivelogs(){
if  ls $CAPDIR/*cap_run*.txt &> /dev/null; then
ts=`date +"%d%b%Y"`
mkdir -p $CAPDIR/logs
(cd $CAPDIR  && tar --remove-files -czf logs/$ts.tgz *cap_run*.txt)
#(cd $CAPDIR && mv *cap_run*.txt /tmp)
echo "INFO: Archived logs to logs/$ts.tgz"
fi
}
setupenv()
{
CAPDIR="/home/testuser/apps"
CAPEXE="/home/testuser/.rbenv/versions/2.1.5/bin/cap"
MAILRECIP="jun...@ruby.com"
export CAPDIR CAPEXE MAILRECIP
}

emaillogs()
{
test -p sock || mkfifo sock
(echo 'set realname="Capistrano QA Buildserver"'; echo 'set from="jun...@ruby.com"'; echo 'set use_from=yes') > sock &
mutt -x -F sock  "$MAILRECIP" -a "$2"  -s "Cap $3 from $1 `date '+%Y/%m/%d %H:%M'`"  <<-EOF
EOF
}

readtag()
{
echo 
read -p "Enter BRANCH value or leave blank to use trunk as repository: " BRANCH
export BRANCH
echo
}

printenv()
{
echo "Select Target environment"
        echo "1). Development"
echo "2). Staging"
echo "3). Production"
read -p 'Enter target environment number [1,2]: ' capenv
case $capenv in
1) export capenv=development
warnenv 'dev';;
2) export capenv=staging
warnenv 'qa';;
3) export capenv=production
warnenv 'prod';;
*)
echo Invalid environment.. exiting..
exit 1
;;
esac
printmenu
}
warnenv(){
if [ -n "$1" ] && [ `expr match ${HOSTNAME} $1` -ne 0 ]; then
true
else
        echo -e "\033[104m Selected environment does not match server naming convention, please 
verify. \033[0m"
read "Enter any key continue or CTRL+C to exit"
fi
}
printmenu()
{
echo -e '\nSelect Cap Task'
echo "1). deploy (Idempotent - Cold + Incremental)"
echo "2). deploy:restart"
read -p 'Enter Cap Task number [1-2]: ' captask
case $captask in
1) 
export captask="deploy"
readtag
;;
2) export captask="deploy:restart";; 
*)
echo Invalid Cap Task.. exiting..
exit 1
;;
esac
}

runcaptask()
{
if [ -d $CAPDIR ]
then
cd $CAPDIR
CAPERRFILE=$1_cap_run_error.txt
CAPOUTFILE=$1_cap_run_out.txt
test -f $CAPERRFILE && rm -f $CAPERRFILE
test -f $CAPOUTFILE && rm -f $CAPOUTFILE
$CAPEXE $1 $2 1>&2 | tee >( grep -v '** \[err ::' > $CAPOUTFILE ) >( egrep "** \[err ::|rolling back|Not a valid URL" > $CAPERRFILE)
sleep 2
if [ -s $CAPERRFILE ]
then
echo -e "\n === Errors encountered during the load, error file will be emailed.. ====\n"
emaillogs $1 "$CAPERRFILE" "Error log"
fi
sed -i 's/--username.*--no-auth-cache/--no-auth-cache/g' "$CAPOUTFILE"
emaillogs $1 "$CAPOUTFILE" "Output log"
else
echo capdir "$CAPDIR" does not exist.. exiting 1
exit 1
fi
}

main



shell script end 


capistrano output terminal


DEBUG [87df8130] Running /usr/bin/env [ -w /deploy/performance ] as exptest@localhost
DEBUG [87df8130] Command: [ -w /deploy/performance ]
DEBUG [87df8130] Finished in 0.087 seconds with exit status 0 (successful).
INFO /deploy/performance is writable on localhost
DEBUG [ad721cff] Running /usr/bin/env svn info https://repos.exphosted.com/svnrepos/talent/trunks/performance/trunk --no-auth-cache --username testuser --password password as exptest@localhost
DEBUG [ad721cff] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env svn info https://repos.exphosted.com/svnrepos/talent/trunks/performance/trunk --no-auth-cache --username testuser --password password )
DEBUG [ad721cff] Path: trunk
DEBUG [ad721cff] Repository Root: https://repos.exphosted.com/svnrepos/talent
DEBUG [ad721cff] Repository UUID: 046189a5-dd13-4ffe-9aed-75e473ac8285
DEBUG [ad721cff] Revision: 71
DEBUG [ad721cff] Node Kind: directory
DEBUG [ad721cff] Last Changed Author: testuser
DEBUG [ad721cff] Last Changed Rev: 71
DEBUG [ad721cff] Last Changed Date: 2015-02-20 12:45:05 -0500 (Fri, 20 Feb 2015)
DEBUG [ad721cff]
DEBUG [ad721cff] Finished in 1.039 seconds with exit status 0 (successful).
INFO [7f842a8a] Running /usr/bin/env mkdir -p /deploy/performance/shared /deploy/performance/releases as exptest@localhost
DEBUG [7f842a8a] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/shared /deploy/performance/releases )
INFO [7f842a8a] Finished in 0.185 seconds with exit status 0 (successful).
INFO [2380afe1] Running /usr/bin/env mkdir -p /deploy/performance/shared/config/environments /deploy/performance/shared/log /deploy/performance/shared/public/system /deploy/performance/shared/log as exptest@localhost
DEBUG [2380afe1] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/shared/config/environments /deploy/performance/shared/log /deploy/performance/shared/public/system /deploy/performance/shared/log )
INFO [2380afe1] Finished in 0.176 seconds with exit status 0 (successful).
INFO [2686f1dc] Running /usr/bin/env mkdir -p /deploy/performance/shared/config as exptest@localhost
DEBUG [2686f1dc] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/shared/config )
INFO [2686f1dc] Finished in 0.175 seconds with exit status 0 (successful).
DEBUG [7f6f6ef9] Running /usr/bin/env [ -f /deploy/performance/shared/config/database.yml ] as exptest@localhost
DEBUG [7f6f6ef9] Command: [ -f /deploy/performance/shared/config/database.yml ]
DEBUG [7f6f6ef9] Finished in 0.177 seconds with exit status 0 (successful).
DEBUG [daebf83a] Running /usr/bin/env [ -f /deploy/performance/current/REVISION ] as exptest@localhost
DEBUG [daebf83a] Command: [ -f /deploy/performance/current/REVISION ]
DEBUG [daebf83a] Finished in 0.182 seconds with exit status 0 (successful).
DEBUG [47dbb92c] Running /usr/bin/env cat /deploy/performance/current/REVISION 2>/dev/null as exptest@localhost
DEBUG [47dbb92c] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env cat /deploy/performance/current/REVISION 2>/dev/null )
DEBUG [47dbb92c] r71''
DEBUG [47dbb92c] Finished in 0.180 seconds with exit status 0 (successful).
DEBUG [531c500c] Running /usr/bin/env [ -d /deploy/performance/repo/.svn ] as exptest@localhost
DEBUG [531c500c] Command: [ -d /deploy/performance/repo/.svn ]
DEBUG [531c500c] Finished in 0.180 seconds with exit status 0 (successful).
INFO The repository mirror is at /deploy/performance/repo
DEBUG [f9bd0555] Running /usr/bin/env if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi as exptest@localhost
DEBUG [f9bd0555] Command: if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi
DEBUG [f9bd0555] Finished in 0.172 seconds with exit status 0 (successful).
INFO [3f3aaa84] Running /usr/bin/env svn update --no-auth-cache --username testuser --password password as exptest@localhost
DEBUG [3f3aaa84] Command: cd /deploy/performance/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env svn update --no-auth-cache --username testuser --password password )
DEBUG [3f3aaa84] At revision 71.
INFO [3f3aaa84] Finished in 1.055 seconds with exit status 0 (successful).
DEBUG [8f88f80f] Running /usr/bin/env if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi as exptest@localhost
DEBUG [8f88f80f] Command: if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi
DEBUG [8f88f80f] Finished in 0.194 seconds with exit status 0 (successful).
INFO [5ca43bec] Running /usr/bin/env svn export . /deploy/performance/releases/20150224121443 as exptest@localhost
DEBUG [5ca43bec] Command: cd /deploy/performance/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env svn export . /deploy/performance/releases/20150224121443 )
DEBUG [5ca43bec] Export complete.
INFO [5ca43bec] Finished in 0.330 seconds with exit status 0 (successful).
DEBUG [bdcde9bf] Running /usr/bin/env if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi as exptest@localhost
DEBUG [bdcde9bf] Command: if test ! -d /deploy/performance/repo; then echo "Directory does not exist '/deploy/performance/repo'" 1>&2; false; fi
DEBUG [bdcde9bf] Finished in 0.145 seconds with exit status 0 (successful).
DEBUG [6b14271c] Running /usr/bin/env svn  log --no-auth-cache --username testuser --password password  -r HEAD -q | tail -n 2 | head -n 1 | sed "s/ |.*/''/" as exptest@localhost
DEBUG [6b14271c] Command: cd /deploy/performance/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env svn  log --no-auth-cache --username testuser --password password  -r HEAD -q | tail -n 2 | head -n 1 | sed "s/ |.*/''/" )
DEBUG [6b14271c] r71''
DEBUG [6b14271c] Finished in 0.815 seconds with exit status 0 (successful).
DEBUG [43198f36] Running /usr/bin/env if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi as exptest@localhost
DEBUG [43198f36] Command: if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi
DEBUG [43198f36] Finished in 0.103 seconds with exit status 0 (successful).
INFO [aa90c714] Running /usr/bin/env echo "r71''" >> REVISION as exptest@localhost
DEBUG [aa90c714] Command: cd /deploy/performance/releases/20150224121443 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env echo "r71''" >> REVISION )
INFO [aa90c714] Finished in 0.099 seconds with exit status 0 (successful).
INFO [8e7f485c] Running /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/config as exptest@localhost
DEBUG [8e7f485c] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/config )
INFO [8e7f485c] Finished in 0.095 seconds with exit status 0 (successful).
DEBUG [aa8d38fc] Running /usr/bin/env [ -L /deploy/performance/releases/20150224121443/config/database.yml ] as exptest@localhost
DEBUG [aa8d38fc] Command: [ -L /deploy/performance/releases/20150224121443/config/database.yml ]
DEBUG [aa8d38fc] Finished in 0.084 seconds with exit status 1 (failed).
DEBUG [a5ba4d0b] Running /usr/bin/env [ -f /deploy/performance/releases/20150224121443/config/database.yml ] as exptest@localhost
DEBUG [a5ba4d0b] Command: [ -f /deploy/performance/releases/20150224121443/config/database.yml ]
DEBUG [a5ba4d0b] Finished in 0.097 seconds with exit status 0 (successful).
INFO [8f942155] Running /usr/bin/env rm /deploy/performance/releases/20150224121443/config/database.yml as exptest@localhost
DEBUG [8f942155] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env rm /deploy/performance/releases/20150224121443/config/database.yml )
INFO [8f942155] Finished in 0.091 seconds with exit status 0 (successful).
INFO [382ece15] Running /usr/bin/env ln -s /deploy/performance/shared/config/database.yml /deploy/performance/releases/20150224121443/config/database.yml as exptest@localhost
DEBUG [382ece15] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ln -s /deploy/performance/shared/config/database.yml /deploy/performance/releases/20150224121443/config/database.yml )
INFO [382ece15] Finished in 0.092 seconds with exit status 0 (successful).
INFO [ee88aee7] Running /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/config /deploy/performance/releases/20150224121443 /deploy/performance/releases/20150224121443/public /deploy/performance/releases/20150224121443 as exptest@localhost
DEBUG [ee88aee7] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/config /deploy/performance/releases/20150224121443 /deploy/performance/releases/20150224121443/public /deploy/performance/releases/20150224121443 )
INFO [ee88aee7] Finished in 0.093 seconds with exit status 0 (successful).
DEBUG [a1ebd1a6] Running /usr/bin/env [ -L /deploy/performance/releases/20150224121443/config/environments ] as exptest@localhost
DEBUG [a1ebd1a6] Command: [ -L /deploy/performance/releases/20150224121443/config/environments ]
DEBUG [a1ebd1a6] Finished in 0.093 seconds with exit status 1 (failed).
DEBUG [ba772af8] Running /usr/bin/env [ -d /deploy/performance/releases/20150224121443/config/environments ] as exptest@localhost
DEBUG [ba772af8] Command: [ -d /deploy/performance/releases/20150224121443/config/environments ]
DEBUG [ba772af8] Finished in 0.092 seconds with exit status 0 (successful).
INFO [d477b844] Running /usr/bin/env rm -rf /deploy/performance/releases/20150224121443/config/environments as exptest@localhost
DEBUG [d477b844] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env rm -rf /deploy/performance/releases/20150224121443/config/environments )
INFO [d477b844] Finished in 0.093 seconds with exit status 0 (successful).
INFO [7b9ea68c] Running /usr/bin/env ln -s /deploy/performance/shared/config/environments /deploy/performance/releases/20150224121443/config/environments as exptest@localhost
DEBUG [7b9ea68c] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ln -s /deploy/performance/shared/config/environments /deploy/performance/releases/20150224121443/config/environments )
INFO [7b9ea68c] Finished in 0.095 seconds with exit status 0 (successful).
DEBUG [b78e0bc6] Running /usr/bin/env [ -L /deploy/performance/releases/20150224121443/log ] as exptest@localhost
DEBUG [b78e0bc6] Command: [ -L /deploy/performance/releases/20150224121443/log ]
DEBUG [b78e0bc6] Finished in 0.092 seconds with exit status 1 (failed).
DEBUG [a2a42a0f] Running /usr/bin/env [ -d /deploy/performance/releases/20150224121443/log ] as exptest@localhost
DEBUG [a2a42a0f] Command: [ -d /deploy/performance/releases/20150224121443/log ]
DEBUG [a2a42a0f] Finished in 0.110 seconds with exit status 0 (successful).
INFO [84f33695] Running /usr/bin/env rm -rf /deploy/performance/releases/20150224121443/log as exptest@localhost
DEBUG [84f33695] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env rm -rf /deploy/performance/releases/20150224121443/log )
INFO [84f33695] Finished in 0.100 seconds with exit status 0 (successful).
INFO [0dd0cd42] Running /usr/bin/env ln -s /deploy/performance/shared/log /deploy/performance/releases/20150224121443/log as exptest@localhost
DEBUG [0dd0cd42] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ln -s /deploy/performance/shared/log /deploy/performance/releases/20150224121443/log )
INFO [0dd0cd42] Finished in 0.100 seconds with exit status 0 (successful).
DEBUG [3032d0c1] Running /usr/bin/env [ -L /deploy/performance/releases/20150224121443/public/system ] as exptest@localhost
DEBUG [3032d0c1] Command: [ -L /deploy/performance/releases/20150224121443/public/system ]
DEBUG [3032d0c1] Finished in 0.095 seconds with exit status 1 (failed).
DEBUG [cdf8f8a1] Running /usr/bin/env [ -d /deploy/performance/releases/20150224121443/public/system ] as exptest@localhost
DEBUG [cdf8f8a1] Command: [ -d /deploy/performance/releases/20150224121443/public/system ]
DEBUG [cdf8f8a1] Finished in 0.099 seconds with exit status 1 (failed).
INFO [d603e58e] Running /usr/bin/env ln -s /deploy/performance/shared/public/system /deploy/performance/releases/20150224121443/public/system as exptest@localhost
DEBUG [d603e58e] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ln -s /deploy/performance/shared/public/system /deploy/performance/releases/20150224121443/public/system )
INFO [d603e58e] Finished in 0.189 seconds with exit status 0 (successful).
DEBUG [8888857b] Running /usr/bin/env [ -L /deploy/performance/releases/20150224121443/log ] as exptest@localhost
DEBUG [8888857b] Command: [ -L /deploy/performance/releases/20150224121443/log ]
DEBUG [8888857b] Finished in 0.185 seconds with exit status 0 (successful).
DEBUG [677b7ed8] Running /usr/bin/env if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi as exptest@localhost
DEBUG [677b7ed8] Command: if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi
DEBUG [677b7ed8] Finished in 0.199 seconds with exit status 0 (successful).
INFO [c6e0e206] Running ~/.rbenv/bin/rbenv exec bundle install --path /deploy/performance/shared/bundle --without development test --deployment --quiet as exptest@localhost
DEBUG [c6e0e206] Command: cd /deploy/performance/releases/20150224121443 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 ~/.rbenv/bin/rbenv exec bundle install --path /deploy/performance/shared/bundle --without development test --deployment --quiet )
INFO [c6e0e206] Finished in 0.819 seconds with exit status 0 (successful).
INFO [d14b96b0] Running /usr/bin/env echo 'backup db' as exptest@localhost
DEBUG [d14b96b0] Command: echo 'backup db'
INFO [d14b96b0] Finished in 0.090 seconds with exit status 0 (successful).
DEBUG [d14b96b0] backup db
INFO [d14b96b0] Finished in 0.090 seconds with exit status 0 (successful).
INFO [3056f450] Running /usr/bin/env ~/bin/runbackup.sh as exptest@localhost
DEBUG [3056f450] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ~/bin/runbackup.sh )
DEBUG [3056f450] Backing up performance_development db...
DEBUG [3056f450] performance_development database dmp gzipped to file performance_development_201502240714.sql.gz ...
INFO [3056f450] Finished in 0.149 seconds with exit status 0 (successful).
DEBUG [70c35abf] Running /usr/bin/env if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi as exptest@localhost
DEBUG [70c35abf] Command: if test ! -d /deploy/performance/releases/20150224121443; then echo "Directory does not exist '/deploy/performance/releases/20150224121443'" 1>&2; false; fi
DEBUG [70c35abf] Finished in 0.086 seconds with exit status 0 (successful).
INFO [ca8ebb2c] Running ~/.rbenv/bin/rbenv exec bundle exec rake db:migrate as exptest@localhost
DEBUG [ca8ebb2c] Command: cd /deploy/performance/releases/20150224121443 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 RAILS_ENV=development ~/.rbenv/bin/rbenv exec bundle exec rake db:migrate )
INFO [ca8ebb2c] Finished in 3.129 seconds with exit status 0 (successful).
INFO [33a20c68] Running /usr/bin/env ln -s /deploy/performance/releases/20150224121443 /deploy/performance/releases/current as exptest@localhost
DEBUG [33a20c68] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ln -s /deploy/performance/releases/20150224121443 /deploy/performance/releases/current )
INFO [33a20c68] Finished in 0.108 seconds with exit status 0 (successful).
INFO [f4f71d10] Running /usr/bin/env mv /deploy/performance/releases/current /deploy/performance as exptest@localhost
DEBUG [f4f71d10] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mv /deploy/performance/releases/current /deploy/performance )
INFO [f4f71d10] Finished in 0.185 seconds with exit status 0 (successful).
INFO [292b180e] Running /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/tmp as exptest@localhost
DEBUG [292b180e] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env mkdir -p /deploy/performance/releases/20150224121443/tmp )
INFO [292b180e] Finished in 0.185 seconds with exit status 0 (successful).
INFO [6895b0be] Running /usr/bin/env touch /deploy/performance/releases/20150224121443/tmp/restart.txt as exptest@localhost
DEBUG [6895b0be] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env touch /deploy/performance/releases/20150224121443/tmp/restart.txt )
INFO [6895b0be] Finished in 0.167 seconds with exit status 0 (successful).
INFO [7bcfcc6a] Running /usr/bin/env touch /deploy/performance/releases/20150224121443/tmp/restart.txt as exptest@localhost
DEBUG [7bcfcc6a] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env touch /deploy/performance/releases/20150224121443/tmp/restart.txt )
INFO [7bcfcc6a] Finished in 0.125 seconds with exit status 0 (successful).
DEBUG [f4ab8784] Running /usr/bin/env ls -xtr /deploy/performance/releases as exptest@localhost
DEBUG [f4ab8784] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env ls -xtr /deploy/performance/releases )
DEBUG [f4ab8784] 20150224092615 20150224092723 20150224100102 20150224104340 20150224104430
DEBUG [f4ab8784] 20150224121443
DEBUG [f4ab8784] Finished in 0.117 seconds with exit status 0 (successful).
INFO Keeping 5 of 6 deployed releases on localhost
INFO [a50cc490] Running /usr/bin/env rm -rf /deploy/performance/releases/20150224092615 as exptest@localhost
DEBUG [a50cc490] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env rm -rf /deploy/performance/releases/20150224092615 )
INFO [a50cc490] Finished in 0.140 seconds with exit status 0 (successful).
DEBUG [64570a47] Running /usr/bin/env if test ! -d /deploy/performance/releases; then echo "Directory does not exist '/deploy/performance/releases'" 1>&2; false; fi as exptest@localhost
DEBUG [64570a47] Command: if test ! -d /deploy/performance/releases; then echo "Directory does not exist '/deploy/performance/releases'" 1>&2; false; fi
DEBUG [64570a47] Finished in 0.141 seconds with exit status 0 (successful).
INFO [62d764da] Running /usr/bin/env echo "Branch trunk (at r71'') deployed as release 20150224121443 by root" >> /deploy/performance/revisions.log as exptest@localhost
DEBUG [62d764da] Command: echo "Branch trunk (at r71'') deployed as release 20150224121443 by root" >> /deploy/performance/revisions.log
INFO [62d764da] Finished in 0.206 seconds with exit status 0 (successful).





run

Lee Hambley

unread,
Feb 24, 2015, 8:16:49 AM2/24/15
to Capistrano

Sorry we can’t help you debugging shell scripts. Capistrano logs it’s output to the host machine’s stdout.

Regarding whatever happened inside your shell script, if you can make a minimum reproduction case we might be able to help you, or if you had posted it somewhere with syntax highlighting or monospaced fonts, or even told us what the error is. Are you trying to redirect Capistrano’s output, or use Capistrano to redirect the output of a process running remotely?

junior

unread,
Feb 24, 2015, 10:10:31 AM2/24/15
to capis...@googlegroups.com
HI Lee,
           The problem is if 2>&1 after pipe symbol there is no out put .. It was getting stuck ... the problem exactly is when i apply pipe symbol . In my old version capistrano same script is working .




 $CAPEXE $1 $2 1>&2 | tee >( grep -v '** \[err ::' > $CAPOUTFILE ) >( egrep "** \[err ::|rolling back|Not a valid URL" > $CAPERRFILE)








Lee Hambley

unread,
Feb 24, 2015, 10:45:22 AM2/24/15
to Capistrano
I suspected bad IO redirection (you're sending stdout to stderr, and then piping the result to tee, which I expected would just forward the empty stdout, since everything ran into stderr) but I tried it and I can't reproduce your problem: https://gist.github.com/leehambley/c253d7738797c3aee305

Conclusion: It's not a Capistrano problem.

Some unix commands behave strangely with streams, imagine the following case:

time ./somecommand > afileondisk

Even though, in theory you've piped the output of time, and ./somecommand to the file on disk, in actual fact `time` does special stuff to reopen handles for stdout/err to the real controlling terminal (I couldn't find a reference, but I learned about it in a DestroyAllSoftware screencast, unfortunately behind a paywall)

I believe, especially having read http://stackoverflow.com/questions/692000/how-do-i-write-stderr-to-a-file-while-using-tee-with-a-pipe that tee seems to do something similar.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.

junior

unread,
Feb 25, 2015, 2:07:01 AM2/25/15
to capis...@googlegroups.com
Hi Lee,
             Thanks for your response in valuable time .

I'll drop the idea of creating capistrano deployment logs from shell script ..

What is the other way to get logs of capistrano kindly guide us . will be help full
Reply all
Reply to author
Forward
0 new messages