gnu-screen

Shell: How to use screen and wait for a couple of background processes in a shell script

白昼怎懂夜的黑 提交于 2019-12-10 10:29:29
问题 I am writing a shell script for a couple of long running processes. First of all I need to run all commands in the screen session manager, so that the execution of a process does not end if a user has been disconnected. Later I need wait for some background processes, which has been created before, to end, so that the following process can start. My question is how to start a screen session in a shell script and wait for the background processes to end. 回答1: You can't invoke screen (or nohup

Screen + vim causes shift-enter to insert 'M' and a newline

泪湿孤枕 提交于 2019-12-09 10:23:51
问题 When running a vim instance in gnu screen hitting shift enter in insert mode adds an 'M' and then a newline, rather than just a newline. Does anybody know what the problem might be, or where to look? Relevant system info: Ubuntu 8.04.1 Screen version 4.00.03 (FAU) 23-Oct-06 VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 31 2008 12:20:21) Included patches: 1-138 Konsole 1.6.6 (Using KDE 3.5.10) Thanks to the comments. When checking the value of $TERM I noticed that it was xterm (as expected)

Sending input to a screen window from vim

点点圈 提交于 2019-12-08 17:00:46
I have a vim function set up where I can highlight a line of text and execute in clojure. Here's the function: function! Clojure_execline() let cl = (getline(line("."))) // ... exec 'clojure -e "' . cl . '"' endfunction The problem with this is that it's slow to start and because it spawns a new clojure session every time I run it, I can't call a function I ran previously. Ideally, I'd like for a hidden repl to be running where I could send input from vim and retrieve the output from as well. I learned about gnu screen and thought it could help me, but I don't know how to send input from one

Screen big data without interrupting data conversion

不羁的心 提交于 2019-12-08 11:37:45
问题 This thread is an extension of this thread where the interruption (CTRL-c) stop the data transfer into less. I would like to create a similar system monitoring data conversion as is found in fdupes . I think this can be reached with GNU screen . The tools tee and buffers may not be needed for this so skip the two sections if you want. Hex conversion and tee [skip if you know] You can use whatever hex dumper you want for the task, for instance hexdump -v , od -v -t x1 and xxd -ps for the

How to send command via python to running screen (Ubuntu 12.04)

人盡茶涼 提交于 2019-12-08 08:43:00
问题 I am on Ubuntu 12.04 LTS running Python 2.7. My Python code looks somewhat like this: from os import system system("screen -S session -X stuff 'commandhere'`echo -ne '\015'`") But when I try to run it, it does not do anything. I was wondering whether it was possible to fix this, and if so, how? I am trying to send a command to an active screen "session" where "commandhere" is the command. 回答1: Have you tried subprocess.call() like this: #!/usr/bin/python import subprocess subprocess.call([

GNU screen: how to clear scrollback and screen at once

前提是你 提交于 2019-12-08 07:56:45
问题 I'm looking for a way to clear both the scrollback and the visible screen at once in GNU screen. At the moment I use two separate bindings: C-a, C (which is the default one for clearing the visible text) bind _ eval "scrollback 0" "scrollback 15000" (which clears the scrollback) Can someone point me to how I can do both in one? 回答1: Turns out you can just do: bind _ eval "clear" "scrollback 0" "scrollback 15000" Note that the order seems to matter: it doesn't seem to work every time if you

Get pid of command ran by screen

删除回忆录丶 提交于 2019-12-08 04:46:39
问题 I'm developing a Minecraft (Bukkit) server manager. It's porpuse is only to start it, stop it, back it up and check if it is running. The last one causes the problem. If I do like this to get the pid of the server: subprocess.Popen(["screen", "-dmS", "minecraft-server", "serverstart.sh"]) I get the pid of the screen command, not the startup-script. However it seems like the pid is always one underneath the pid of the startup-script, but I suppose this isn't relaiable. How can I get the pid of

Bind more than one command to single key in screen?

守給你的承諾、 提交于 2019-12-07 18:53:43
问题 how can i bind more than one command to a single key in gnu-screen? I want to combine the two mappings bind c copy bind b eval "writebuf" "exec sh -c 'xsel --clipboard < /tmp/screen-exchange'" to a single one-key mapping. How can this be done? Does anyone know a good tutorial on this advanced configuration/scripting stuff for gnu-screen? Thanks in advance, Chris 回答1: Pass each command as a separate argument to eval , e.g., eval "echo foo" "echo bar" . In your given scenario, I would think

Can you make vi “advance” the screen when opened?

北城以北 提交于 2019-12-07 09:07:21
问题 I often work in vi, suspend vi, run something on the cli, and then fg back into vi to work on the results. For instance, fixing errors that showed up when I ran the cli command. However, when I fg vi, vi "wipes" the current terminal buffer and I can't see the "last screenful" of terminal output in the scrollback buffer. Is there some setting in vi (or screen, I use screen) which would help me here? I have searched google for a long time with no answers. I also realize that there are other

How can I get currently attached screen session name?

有些话、适合烂在心里 提交于 2019-12-07 02:05:45
问题 I'm writing a script which needs the name of the currently attached screen session's name if there's any. 回答1: You might want to check answers here: How do I display the current "session" name or "sockname" of a screen session in the status bar? In short the $STY environment variable is what you are looking for. 来源: https://stackoverflow.com/questions/16848940/how-can-i-get-currently-attached-screen-session-name