Поиск по этому блогу

вторник, 16 июня 2015 г.

How to run command in screen tool and detach

I know that it could be googled, but I always forget this trick.

I'm going to run sleep 10 command.

It's pretty easy:
screen -dmS SCREEN_NAME
screen -S SCREEN_NAME -X stuff 'sleep 10'`echo -ne '\015'`

Note:
Of course someone could add comment that another way to run the command in screen is:
screen -dmS SCREEN_NAME "sleep 10"
I agree, but there is different behaviour: screen will be closed as soon as the command exited, that is why I have provided 2 commands, first one creates a screen, the second one runs sleep 10 command. You alway could attach to the screen and check out stdout/stderr.

Комментариев нет:

Отправить комментарий