Capistrano & Bash: Ignore Command Exit Status

Capistrano & Bash: ignore command exit status

The simplest way is to just append true to the end of your command.

  task :my_task do
run "my_command"
end

Becomes

  task :my_task do
run "my_command; true"
end

Capistrano git:check failed exit status 128

Try generating a new private/public key par and provide a passphrase for it. If it works, the problem is your current key doesn't use a passphrase.

Capistrano executes a command with sudo although it is turned off

You're explicitly running a command in sudo: execute :sudo, 'whoami', why are you surprised that it uses sudo?

As explained in the documentation that you quoted, setting the :use_sudo option to false will tell Capistrano not to use sudo when doing certain operations. If you execute sudo whoami though it's not going to modify your command.

capistrano command is failing silently without any feedback

Solved my own problem.

Look at this for something similar.

I add this line in deploy.rb

default_run_options[:pty] = true

And changed from

run "sudo cp #{shared_path}/logrotate_script /etc/logrotate.d/#{application}"

to this

sudo "cp #{shared_path}/logrotate_script /etc/logrotate.d/#{application}"

Check for given command-line parameters in capistrano

Another method:

$ arg='foo bar baz' cap my_task

and then

ENV['arg'].split #=> ["foo", "bar", "baz"]

rails 4.1 can't deploy via capistrano 3

As was written above, probably, you have not enough RAM.

I solved problem by adding SWAP file on my Ubuntu 14.04 server:

Under the root:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile

Add next line to /etc/fstab:

 /swapfile       none    swap    sw      0       0 

and:

echo 0 > /proc/sys/vm/swappiness
sudo chown root:root /swapfile
sudo chmod 0600 /swapfile

check SWAP(maybe need reloading):

swapon -s 

— How To Add Swap on Ubuntu 14.04 @ Digital Ocean Community

Why is capistrano interpreting a flag passed with a command to `run` as input?

I just found this in man echo:

Some shells may provide a builtin echo command which is similar or identical to this utility. Most notably, the builtin echo in sh(1) does not accept the -n option. Consult the builtin(1) manual page.

My version of bash has an echo builtin but seems to be respecting the -n flag. It looks like the shell on your deployment machine doesn't, in which case using the full path to the echo binary might do what you want here:

run "/bin/echo -n 'foo' > bar.txt"


Related Topics



Leave a reply



Submit