本文介绍了简历最后一个屏幕上,如果有的话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我需要有一个脚本来检查,如果有一个屏幕上运行的serverman。
如果它存在,然后恢复它,否则创建新的。

Basically i need to have a script that checks if there is a screen running as "serverman".If it exists, then resume it, otherwise create new.

所以我想解析sceen -ls,并检查是否有一个名为serverman。

So i wanted to parse "sceen -ls" and check if there is one called "serverman".

这是屏幕-ls输出

There are screens on:
    7423.212        (03/09/14 08:48:58)     (Detached)
    7411.1as        (03/09/14 08:48:49)     (Detached)
2 Sockets in /var/run/screen/S-root.

我要武术的思考,可以分析它槽管道和搜索serverman字的命令。
如果任何一组isalreadyrunning = 1,否则为0,但我不知道是什么命令来使用以及如何使用,你呢?

I was tinking to a command that could parse it trough piping and search for "serverman" word.And if any set isalreadyrunning=1, else set it to 0, but i don't know what command to use and how to use, do you?

推荐答案

您已经可以与现有的屏幕做到这一点选项没有一个叫会话显式检查。如果不存在屏幕-D -R serverman 将附加到 serverman ,但将创建它,如果不重视它。

You can already do this with existing screen options without explicitly checking for a named session. screen -D -R serverman will attach to serverman if exists, but will create it and attach to it if not.

这篇关于简历最后一个屏幕上,如果有的话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:35
查看更多