I have the following in my .screenrc file:

# Don't display the copyright page
startup_message off

# keep scrollback n line
defscrollback 5000

# setup some screens
screen -t top 0 top -o cpu -s 5
screen -t mysql 1 mysql -u root -p
screen -t shell_screen 2 cd ~/webroot
screen -t report_gen 3 tail -f ~/webroot/path/report_gen_log.txt

shelltitle "$ |bash"

#change the hardstatus settings to give an window list at the bottom of the
##screen, with the time and date and with the current window highlighted
hardstatus             alwayslastline
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

When I start up screen, only the first 2 screens are created.

What might be wrong?

I am runnong OSX, but I dont think that matters.

link|improve this question

80% accept rate
feedback

2 Answers

up vote 8 down vote accepted

Kyle is right -- that screen window 2 will fail because cd is a shell builtin. Even if it was a command, it would terminate immediately, and screen would close that window.

You can do something like this to get that to work:

screen -t shell_screen 2 bash -c "cd ~/webroot && bash"

The tail command (window 3) fails because of the "~" character. Screen does not do shell-style expansion, and so tail immediately fails (cannot open file) and terminates, and the screen windows is closed. Manually expand that ~ to the full path to your home directory, and that screen should work.

link|improve this answer
2  
+1 For the better Answer :-) – Kyle Brandt Aug 6 '09 at 18:17
2  
One addition to the tail issue: I'd suggest using '-F' instead of '-f' as it'll keep tailing even if the file is renamed, rolled, etc – morgant Aug 6 '09 at 18:19
Thxs worked perfect. I actually added the bash -c around all of the commands so if they are exited by accident, i don't loose the window. – Darryl Hein Aug 6 '09 at 19:24
1  
Daryl, you can also use 'zombie qr' in your rc instead of running everything in bash -c. – Kyle Brandt Aug 6 '09 at 19:26
feedback

Not sure why the tail fails, but cd is a shell builtin, not a command, So you should get a no such command in window 2.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.