Fri 19 Sep 2008 02:14:13 AM UTC, original submission:
I'm getting some odd behaviour when i use:
echo "yum -y update" > ./tmp ; screen -d -m bash --rcfile ./tmp ; rm -f ./tmp
the reason i want to run this is:
1) i want to start an update process automatically (using at) so that no-one needs to be on site for the commencement of an outage, but the attending sysadmin can still look over the overall output to verify the operation succeeded/failed.
2) I would prefer this over looking at /var/log/yum.log because if the attending sysadmin arrives s/he can step into the session and observe progress.
3) Any odd errors should be captured in context, and are not limited to yum
why invoke the command like this:
1) screen -d -m <cmd> means that the screen will start with <cmd> running inside of it, and then detatch.
<cmd> here is bash --rcfile <some file> where <some file> is pre-loaded via an echo, but can of course be created via an editor.
2) importance of <cmd> being bash --rcfile, rather than `yum -y update` or anything else for that matter short of a shell. bash without --rcfile terminates after completion, with bash is started to execute the instructions in rcfile specified.
The actual fault:
Sorry about the long road here, the problem is that screen is not consistent in how it operates:
occasionally i run it and then connect to it using `screen -r` or run `screen -ls` and connect to the listed session using `screen -r -d <session id>` and there will be what yum has been doing. But quite often there will be a shiny new, and apparently untouched, prompt.
Log files can verify that the yum did actually run and complete, however the output is not visible, but sometimes it is.
There seems to be a consistent thread however: it appears to relate somehow to the activity of the command. For example, if instead `yum -y update` something like `while true; do echo it works; done` connecting to the screen succeeds with the output being visible.
Issue 1:
consistency - this might not be a bug and i might just type faster some times and not other times. However i have used `echo "hello"` in my rcfile and observed it. So i have some doubts there, however in writing this, was unable to replicate this.
Issue 2:
maybe i'm doing something i shouldn't - i'm relatively new to screen, i've been using it to work around a firewall bug, and really only to start, work in it, and reconnect if need be. I seldomly disconnect and rejoin. Recently i found the ability to work cooperatively using it, but this is probably the fanciest i've attempted to do. Am i maybe just missing something in the man page?
Urgency / Impact:
Minute - neither cron nor at let me actually see a session that screen should have created anyway, so even if this were to be sorted out, odds are it would not fix >my< problem. but it might make screen more consistent.
Cheers, and sorry if i gave too much information / detail.
-unavailable-
|