如何给airscreenserver里的minecraft server发命令

1326人阅读
Linux使用(65)
linux中screen命令的用法
作为linux服务器管理员,经常要使用ssh登陆到远程linux机器上做一些耗时的操作。
也许你遇到过使用telnet或SSH远程登录linux,运行一些程序。如果这些程序需要运行很长时间(几个小时),而程序运行过程中出现网络故障,或者客户机故障,这时候客户机与远程服务器的链接将终端,并且远程服务器没有正常结束的命令将被迫终止。
又比如你SSH到主机上后,开始批量的scp命令,如果这个ssh线程断线了,scp进程就中断了。在远程服务器上正在运行某些耗时的作业,但是工作还没做完快要下班了,退出的话就会中断操作了,如何才好呢?
&我们利用screen命令可以很好的解决这个问题。实现在断开SSH的情况下,在服务器上继续执行程序。
那什么是screen命令?
Screen被称之为一个全屏窗口管理器,用他可以轻松在一个物理终端上获得多个虚拟终端的效果。
Screen功能说明:
简单来说,Screen是一个可以在多个进程之间多路复用一个物理终端的窗口管理器,这意味着你能够使用一个单一的终端窗口运行多终端的应用。Screen中有会话的概念,用户可以在一个screen会话中创建多个screen窗口,在每一个screen窗口中就像操作一个真实的telnet/SSH连接窗口那样。
Screen命令语法:
screen [-AmRvx -ls -wipe][-d &作业名称&][-h &行数&][-r &作业名称&][-s ][-S &作业名称&]
Screen命令参数:
-A -[r|R]&&&&&&&&& 将所有的视窗都调整为目前终端机的大小。
-c filename&&&&&&& 用指定的filename文件替代screen的配置文件’.screenrc’.
-d [pid.tty.host]& 断开screen进程(使用该命令时,screen的状态一定要是Attached,也就是说有用户连在screen里)。一般进程的名字是以pid.tty.host这种形式表示(用screen -list命令可以看出状态)。
-D [pid.tty.host]& 与-d命令实现一样的功能,区别就是如果执行成功,会踢掉原来在screen里的用户并让他logout。
-h &行数&  &&&&&& 指定视窗的缓冲区行数。
-ls或–list&&&&&&& 显示目前所有的screen作业。
-m&&&&&&&&&&&&&&&&&&& 即使目前已在作业中的screen作业,仍强制建立新的screen作业。
-p number or name& 预先选择一个窗口。
-r [pid.tty.host]& 恢复离线的screen进程,如果有多个断开的进程,需要指定[pid.tty.host]
-R&&&&&&&&&&&&&&&&&&&&& 先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
-s shell&&&&&&&&&&&& 指定建立新视窗时,所要执行的shell。
-S &作业名称&& 指定screen作业的名称。(用来替代[pid.tty.host]的命名方式,可以简化操作).
-v&&&&&&&&&&&&&&&&&&&& 显示版本信息。
-wipe&&&&&&&&&&&&&&& 检查目前所有的screen作业,并删除已经无法使用的screen作业。
-x&&&&&&&&&&&&&&&&&&&& 恢复之前离线的screen作业。
Screen命令的常规用法:
screen -d -r:连接一个screen进程,如果该进程是attached,就先踢掉远端用户再连接。
screen -D -r:连接一个screen进程,如果该进程是attached,就先踢掉远端用户并让他logout再连接
screen -ls或者-list:显示存在的screen进程,常用命令
screen -m:如果在一个Screen进程里,用快捷键crtl+a c或者直接打screen可以创建一个新窗口,screen -m可以新建一个screen进程。
screen -dm:新建一个screen,并默认是detached模式,也就是建好之后不会连上去。
screen -p number or name:预先选择一个窗口。
Screen实现后台运行程序的简单步骤:
1& 要进行某项操作时,先使用命令创建一个Screen:
[linux@user~]$ screen -S test1
2&接着就可以在里面进行操作了,如果你的任务还没完成就要走开的话,使用命令保留Screen:
[linux@user~]$ Ctrl+a+d&&&&&&&&&&&&&&&&&&& #按Ctrl+a,然后再按d即可保留Screen
[detached]&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #这时会显示出这个提示,说明已经保留好Screen了
如果你工作完成的话,就直接输入:
[linux@user~]$ exit&&&&&&&&&&&&&&&&&&&&&&& #这样就表示成功退出了
[screen is terminating]
3& 如果你上一次保留了Screen,可以使用命令查看:
[linux@user~]$ screen -ls
There is a screen on:
9649.test1&& (Detached)
恢复Screen,使用命令:
[linux@user~]$ screen -r test1 (or 9649)
Screen命令中用到的快捷键
Ctrl+a c :创建窗口
Ctrl+a w :窗口列表
Ctrl+a n :下一个窗口
Ctrl+a p :上一个窗口
Ctrl+a 0-9 :在第0个窗口和第9个窗口之间切换
Ctrl+a K(大写) :关闭当前窗口,并且切换到下一个窗口(当退出最后一个窗口时,该终端自动终止,并且退回到原始shell状态)
exit :关闭当前窗口,并且切换到下一个窗口(当退出最后一个窗口时,该终端自动终止,并且退回到原始shell状态)
Ctrl+a d :退出当前终端,返回加载screen前的shell命令状态
Most of the time GUI is not available on remote Linux system, you login over ssh and start to work, if you need to run two or three task at a time, you login over ssh two or three times. However, with screen windows manager utility you can run multiple terminals
at the same time from single console login over ssh session (UNIX guru uses the term called& multiplexing for this concept). Any seasoned Linux admin should be aware of this nifty tool :)
Install screen if it is not installed under Debian Linux
Type the following command:
# apt-get install screen
FreeBSD user can use ports to install screen
# cd /usr/ports/misc/screen
# make install clean
Login to remote server over ssh
(C) Start screen session. You can name your window/session (1 is name of session):
$ screen -S 1
Let us start pine mail reader on first session or window.
(D) Next you would like to download something from ftp/http site while you are reading emails. You need to create another screen window by pressing special key combination. Press CTRL + a& followed by c key (first hit CTRL+a, releases both keys and press
c).& As soon as you hit 'c' you will get new shell prompt at console. Now use wget to download belenix.iso.bz2 (Solaris live CD) from net:
$ wget http://www.genunix.org/distributions/belenix_site/binfiles/belenix.iso.bz2
(E) But how do I switch between these two tasks?
Switching between windows is the specialty of screen utility. So to switch between pine and wget window (or session) press CTRL+a followed by n key (first hit CTRL+a, releases both keys and press n).To list all windows use the command CTRL+a followed by & key (first hit CTRL+a, releases both keys and press & ).To switch to window by number use the command CTRL+a followed by ' (first hit CTRL+a, releases both keys and press ' it will prompt for window number).
Common screen commands
screen command
Ctrl+a c
Create new window
Ctrl+a k
Kill the current window / session
Ctrl+a w
List all windows
Ctrl+a 0-9
Go to a window numbered 0 9, use Ctrl+a w to see number
Ctrl+a Ctrl+a
Toggle / switch between the current and previous window
Ctrl+a S
Split terminal horizontally into regions and press Ctrl+a c to create new window there
Ctrl+a :resize
Resize region
Ctrl+a :fit
Fit screen size to new terminal size. You can also hit Ctrl+a F for the the same task
Ctrl+a :remove
Remove / delete region. You can also hit Ctrl+a X for the same taks
Ctrl+a tab
Move to next region
Ctrl+a D (Shift-d)
Power detach and logout
Ctrl+a d
Detach but keep shell window open
Ctrl-a Ctrl-\
Quit screen
Display help screen i.e. display a list of commands
Suggested readings:
See screen command man page for further details:
man screen
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:804162次
积分:8459
积分:8459
排名:第1712名
原创:127篇
转载:183篇
评论:68条
(2)(3)(1)(1)(1)(1)(6)(1)(2)(2)(1)(3)(7)(1)(2)(8)(3)(1)(4)(1)(6)(2)(2)(6)(6)(2)(24)(12)(13)(3)(2)(3)(6)(3)(8)(8)(6)(6)(5)(4)(8)(1)(4)(2)(6)(3)(2)(4)(4)(1)(9)(1)(3)(1)(1)(2)(1)(1)(8)(6)(5)(11)(2)(1)(3)(3)(2)(7)(5)(2)(8)(4)(4)(7)<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&}

我要回帖

更多关于 screenrecord 命令 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信