gnu-screen

bash cron flock screen

匆匆过客 提交于 2019-11-28 01:43:20
I am using cron to run a bash script periodically, and trying to use flock to prevent this script and the processes it creates from being run multiple times. The entry in crontab to run it every minute is: */1 * * * * flock -n /tmp/mylockfile /home/user/myscript.sh arg1 arg2 The problem is, myscript.sh spawns multiple screen sessions in detached mode, it contains for i in {1..3}; do screen -d -m ./mysubscript.sh arg3 done Running screen with "-d -m" as above starts screen in "detached" mode as forked process, but these processes do not inherit the lock from flock, so that every minute 3 new

What is GNU Screen? [closed]

狂风中的少年 提交于 2019-11-27 21:27:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . What is GNU Screen? 回答1: What is GNU Screen? Great! Erm, a slightly more useful answer: it allows you to run multiple console applications, or commands, in one terminal. Kind of like a tabbed terminal emulator.

Send commands to a GNU screen

一笑奈何 提交于 2019-11-27 20:34:30
I have a GNU screen named demo, I want to send commands to it. How do I do this? screen -S demo -X /home/aa/scripts/outputs.sh yeilds No screen session found. and doing screen -ls shows that it isn't running. If the Screen session isn't running, you won't be able to send things to it. Start it first. Once you've got a session, you need to distinguish between Screen commands and keyboard input. screen -X expects a Screen command. The stuff command sends input, and if you want to run that program from a shell prompt, you'll have to pass a newline as well. screen -S demo -X stuff '/home/aa

How do I display the current “session” name or “sockname” of a screen session in the status bar?

血红的双手。 提交于 2019-11-27 20:04:58
问题 I run multiple screen sessions each created with 'screen -S name ' and I would like to be able to display in the status bar the name I used to create the current screen session. However, I cannot seem to accomplish this. Any ideas? 回答1: screen has two status bars, the caption bar and the hardstatus bar, both of which use the string escapes specified in the "STRING ESCAPES" section of man screen. Unfortunately, there is no escape that directly refers to the session name. However, there is a

How to send control+c from a bash script?

匆匆过客 提交于 2019-11-27 17:57:27
I'm starting a number of screens in a bash script, then running django's runserver command in each of them. I'd like to be able to programmatically stop them all as well, which requires me to send Control+c to runserver . How can I send these keystrokes from my bash script? Ctrl+C sends a SIGINT signal. kill -INT <pid> sends a SIGINT signal too: # Terminates the program (like Ctrl+C) kill -INT 888 # Force kill kill -9 888 Assuming 888 is your process ID. Note that kill 888 sends a SIGTERM signal, which is slightly different, but will also ask for the program to stop. So if you know what you

Save “screen” (program) output to a file

那年仲夏 提交于 2019-11-27 10:28:43
I need to save the whole output of screen to a file to check later all the content. The reason is that I'm dumping a flash memory trough serial port, using screen to interface with it. I would like to save it to a file to check memory structure. I've tried : $: screen /dev/ttyUSB0 115200 >> foo.txt $: screen /dev/ttyUSB0 115200 | tee foo.txt and I've also tried to use bufferfile from screen, but I don't understand how to use it. Is there an easy way? There is a command line option for logging. The output is saved to screenlog.n file, where n is a number of the screen. From man pages of screen:

How do you start Unix screen command with a command?

試著忘記壹切 提交于 2019-11-27 10:08:51
问题 According to the docs for the Unix "screen" command, you can configure it in .screenrc to start with a bunch of default screens, each running a command that you specify. Here's my cofig: # Default screens screen -t "shell_0" 1 screen -t "autotest" 2 cd ~/project/contactdb ; autotest It will not run the autotest command. That window where I'm trying to run autotest just closes instantly when I start screen . I also tried it with just... screen -t "autotest" 2 cd ~/project/contactdb Same result

Copying GNU screen scrollback buffer to file (extended hardcopy)?

故事扮演 提交于 2019-11-27 09:09:33
问题 How do I easily copy the GNU screen scrollback buffer to a file? IE, a more powerful version of the 'hardcopy' command? In GNU screen, I can use " ctrl - a ESC " to enter the scrollback buffer. I could then mark the entire buffer and use " ctrl - a ctrl - ] " to paste it into an emacs buffer, thus saving it to a file. However, this is tedious. Is there a screen command that'll simply copy the scrollback buffer to a file, like 'hardcopy' does for the visible portion of the screen? 回答1: To

How to list running screen sessions?

二次信任 提交于 2019-11-27 09:03:15
问题 I have a bunch of servers, on which I run experiments using screen . The procedure is the following : ssh to server XXX launch screen start experiments in a few tabs detach screen disconnect from the server While the experiments are running, I can easily find on which servers they are by ssh ing to all servers and listing my running processes (using top or ps ). However, once the experiments are finished, how could I find on which servers I have a screen session opened (so that I can have a

How do I increase the scrollback buffer in a running screen session?

微笑、不失礼 提交于 2019-11-27 08:57:29
问题 Lets say I have a currently running screen session I am interacting with through putty. I've realized that the scrollback buffer is too small and would like to increase it without starting a new screen session. Is there a way to do this? 回答1: The man page explains that you can enter command line mode in a running session by typing Ctrl + A , : , then issuing the scrollback <num> command. 回答2: Press Ctrl-a then : and then type scrollback 10000 to get a 10000 line buffer, for example. You can