Attach, Detach and Kill a process in Screen with a bash script - Ask Ubuntu


i know can run program in detached screen, log existing screen, kill running process, restart , detach.

is possible bash script, how can send ctrl-a ctrl-d , ctrl-c instance?

if want remove screen can delete screen name in /var/run/screens/{user/ , screen -wipe.

but screen has stuff , paste command:

  • command: paste [registers [destination]]

    (c-a ], c-a c-]) 

    write (concatenated) contents of specified registers stdin stream of current window. register ‘.’ treated paste buffer. if no parameter specified user prompted enter single register. paste buffer can filled copy, history , readbuf commands. other registers can filled register, readreg , paste commands. if paste called second argument, contents of specified registers pasted named destination register rather window. if ‘.’ used second argument, display's paste buffer destination. note, paste uses wide variety of resources: both, current window , current display required. whenever second argument specified no current window needed. when source specification contains registers (not paste buffer) there need not current display (terminal attached), registers global resource. paste buffer exists once every user.

  • command: stuff {string}

    stuff string string in input buffer of current window. paste command, less overhead. cannot paste large buffers stuff command. useful key bindings. see bindkey.


so works:

screen -s session_name -x @ window_number stuff ^c screen -s session_name -x @ window_number stuff ^x 

and sends control-c , control-x respectively , can use combine keycodes (like control a, d)


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User