Bash script gets task log error

Hey there,

Got my 2020.1 Octopus up and running and testing some Bash scripts aginst one of my Linux servers, but keep getting a strange result.

The following command gives an error 1 and not 0 as it should.

smbclient //server/share Password -W server -U user -c "get serverfile localfile"

it works just fine when logged into the server and switching to root, as the tentacle is running as.

I can see this i my log

Process /bin/bash in /etc/octopus/USER/Work/202011111111-4962-104 exited with code 0

Best regards

Hi @thomas3

Thanks for reaching out - this is certainly an odd one. One of the first places I would look here is at the script that gets called by Octopus itself. By default, this is deleted when the deployment fails, but you can save a copy of this directory by using these steps:

Hopefully this gives you some insight as to why it’s failing!

Hi Justin,

Thanks for the tips, but they didn’t really give that much information back. The code is published to my server as it should. But every copy command gives an error 1 in Octopus, even if it doesn’t on the server… That is very strange.
I have now also tired to use smbget and that has the same issue.
smbget smb://user:password@server/share/file

This is what I see in my Octopus log
[file] 0b of 1.88kB (0.00%) at 0b/s ETA: Unknown April 18th 2020 08:29:15 Error

So it does copy the file over after the file copy I put in an “echo $?” and this returns a 0, so where is Octopus getting the “error 1” from!?

Hi @thomas3!

We typically see this in situations where console apps write their progress or other in-app messages to stderr instead of stdout (we see it a lot with things like Terraform), if you redirect your output with 2>&1 at the end of your command, it shouldn’t be seen as an error in Octopus.

Hope this helps!