Weird Korn shell error on Solaris (-110)

Hoping someone can help with some Solaris weirdness… I’m using prefetch to download a Korn shell script onto some Solaris test boxes and then execute the script like so:

wait /bin/sh -c "(cd __Download/ && chmod +x ctm918soinstall.ksh)"
wait /bin/sh -c “(cd __Download/ && ./ctm918soinstall.ksh)”

The script is written to hard-code any paths - to avoid issues with relative paths - and has also included several helpful exit codes. If the application (that the script pertains to) does not exist, it exits with exit code 124… And when I run this on my Solaris 10 & 11 test boxes, I see that exit code returned in the console.

However when I deploy it to the test boxes supplied by the business, I see exit code -110. (All lines of the task complete.) Yet when I check this locally with the server owner via ssh (as I don’t have access to these servers), these commands to chmod and then execute the script from the __Download folder execute no issue.

I’ve also tried wrapping it in an appendfile, but same issue:

delete __appendfile
delete {client folder of current site}/__Download/control-m.sh
appendfile #!/bin/sh
appendfile chmod +x {client folder of current site}/__Download/ctm918soinstall.ksh
appendfile /bin/ksh -c "cd {client folder of current site}/__Download/ && ./ctm918soinstall.ksh"
move __appendfile {client folder of current site}/__Download/control-m.sh
wait chmod 777 {client folder of current site}/__Download/control-m.sh

Any thoughts, or anything obvious I’m missing here?

Its being long time I have seen the “control-m” script. The “ksh” and “sh” syntax is different. you have to execute the script like this

ksh ctm918soinstall.ksh

don’t use the
sh ctm918soinstall.ksh

begin prefetch block
add nohash prefetch item url=http://xyz:52311/Uploads/control-m.ksh
end prefetch block

delete /var/tmp/control-m.ksh
move __Download/control-m.ksh /var/tmp/control-m.ksh

// Set perms on sh script
wait chmod 755 /var/tmp/control-m.ksh

wait /usr/bin/ksh /var/tmp/control-m.ksh

// Cleanup
delete /var/tmp/control-m.ksh

2 Likes

@bigfixforum That helped, thank you! The main issue was the install script was actually using a ‘current directory’ variable that I had missed. So it was looking for the associated files in a custom site Downloads folder rather than /var/tmp. All good now - thanks for your help! :slight_smile:

I am glad it worked.
you welcome:)