LinuxGSM icon indicating copy to clipboard operation
LinuxGSM copied to clipboard

Suggestion: Use "unbuffer" to get by pipe buffer

Open tenpin784 opened this issue 11 years ago • 15 comments

When downloading a game, the buffer of the tee command makes it appear that the download has frozen. By adding unbuffer (from the expect package), it makes it so the status lines are printed out as they happen.

In functions/fn_install_serverfiles:


unbuffer ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp

unbuffer ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp

unbuffer ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp


Just a thought.

--John

tenpin784 avatar Jan 25 '15 15:01 tenpin784

NIce suggestion. I will be implementing this idea. Thanks

dgibbs64 avatar Jan 25 '15 23:01 dgibbs64

Looked at this however you have to install another package to get this to work and when I did the command still wasn't available in ubuntu or debian. Are there other options that are more compatible?

dgibbs64 avatar Jan 26 '15 11:01 dgibbs64

Did you install expect, or expect-dev?

From what I have read, in Ubuntu its in expect-dev. On Jan 26, 2015 5:26 AM, "Daniel Gibbs" [email protected] wrote:

Looked at this however you have to install another package to get this to work and when I did the command still wasn't available in ubuntu or debian. Are there other options that are more compatible?

— Reply to this email directly or view it on GitHub https://github.com/dgibbs64/linuxgameservers/issues/275#issuecomment-71447314 .

tenpin784 avatar Jan 27 '15 05:01 tenpin784

that would be the issue then. I will look at writing this in as an optional. If the server happens to have it installed then it would use it. If not it wont.

dgibbs64 avatar Jan 29 '15 22:01 dgibbs64

Was thinking that too.

something like unbuffer=which unbuffer

if $unbuffer == '' then dont use it.

something like that? On 01/29/2015 04:35 PM, Daniel Gibbs wrote:

that would be the issue then. I will look at writing this in as an optional. If the server happens to have it installed then it would use it. If not it wont.

— Reply to this email directly or view it on GitHub https://github.com/dgibbs64/linuxgameservers/issues/275#issuecomment-72118481.

tenpin784 avatar Jan 29 '15 22:01 tenpin784

yep thats what I have planned :). Won't take look long to implement either

dgibbs64 avatar Jan 29 '15 22:01 dgibbs64

You have a similar command in Linux it's part of the coreutils so it will be present on every system.

The command is stdbuf, take a look at http://linux.die.net/man/1/stdbuf

So for the case above to work you would do it like this.

stdbuf -o 0 <command> | tee <log_file>

ilijamt avatar Apr 07 '15 13:04 ilijamt

Thanks for that @ilijamt I will investigate.

dgibbs64 avatar Apr 15 '15 21:04 dgibbs64

Tried sdbuff got the following error

ERROR: ld.so: object '/usr/lib/coreutils/libstdbuf.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

dgibbs64 avatar May 05 '15 09:05 dgibbs64

I have now implemented unbuffer that will run if available on the distro.

https://github.com/dgibbs64/linuxgsm/commit/044d5f5aec232fd6451219fc45a426123ae1a7f1

dgibbs64 avatar May 05 '15 09:05 dgibbs64

ERROR: ld.so: object '/usr/lib/coreutils/libstdbuf.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

This is an error with the files installed it's trying to load 32 bit but it's loading 64 bit. This is some error with your distribution.

ilijamt avatar May 05 '15 09:05 ilijamt

Makes sense as im running 64-bit but ./steamcmd.sh is 32-bit.

dgibbs64 avatar May 05 '15 10:05 dgibbs64

The only way to implement stdbuf would be to detect if a 32-bit version is installed and use that. otherwise it will just not use it.

dgibbs64 avatar May 05 '15 10:05 dgibbs64

I tried it on 64-bit OS, on my system and it's running without an issue, with stdbuf.

ilijamt avatar May 05 '15 10:05 ilijamt

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jul 19 '18 22:07 lock[bot]