Thursday, February 26, 2009

resume a background progress after logout(not ^z bg/fg)

here I'd like to share with you some useful tips I just founded while learning to set up a CS1.5 server on GNU/Linux. It's about how to resume a progress that had been put into background as you logout, and it's not the ^z and bg/fg stuff.

we have all come crossed such situations that we need to leave for a few seconds or just some unexpected things kicked us out from the system when we were still running a program, say 'nc -l -p 80'. This happens commonly when you are logging in with a not-robust connection, and when we get back, the the program is still there, running in the background. You can see it with a 'ps -A', but never will you be able to 'fg' it.

So, what shall we do?

The answer is 'screen'. With screen, you can safely "save" a running progress in the system, and "resume" it at any time. Following is the usage from 'man screen'.

SCREEN(1) SCREEN(1)

NAME
screen - screen manager with VT100/ANSI terminal emulation

SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]

-d -m Start screen in "detached" mode. This creates a new session but
doesn't attach to it. This is useful for system startup
scripts.

-S sessionname
When creating a new session, this option can be used to specify a
meaningful name for the session. This name identifies the session
for "screen -list" and "screen -r" actions. It substitutes the
default [tty.host] suffix.
And, examples I found at a GUN/Linux CS server howto.

"save a progress in background"

'screen -A -m -d -S hlds ./hlds_run -game cstrike +ip ip.de.internet +sv_lan 1 -nomaster +maxplayers 18 +map de_dust2'

"resume it whenever necessary"

'screen -r hlds'

To make it background again, Hold ctrl, then press and hold A, then press D.

Sunday, February 22, 2009

gong1chuang1.com

今天(2月22号)返回学校才收到上年(2008年)12月24日google中国按照我的申请寄来的益暖中华大学生公益创意大赛的宣传资料,

而大赛的初赛截至日期是2月14号……