Add some entries to /etc/inittab to indicate what should happen on runlevel 4:

+

Add some entries to /etc/inittab to indicate what should happen on runlevel 4, substituting your user name for <user>:

<pre>

<pre>

# gnu screen on rl4

# gnu screen on rl4

Line 101:

Line 101:

fi

fi

</pre>

</pre>

−

This checks for the presence of the flag file and if found, will launch a screen session immediately after the autologin. Quittig the screen session simply gives you a prompt but due to mingetty respawning you cannot logout on vc/1. Note that removing the rl4 file as soon as it is found is very important as you otherwise risk starting screen sessions inside of screen session causing all kinds of weird behaviour.

+

This checks for the presence of the flag file and if found, will launch a screen session immediately after the autologin. Quitting the screen session simply gives you a prompt but due to mingetty respawning you cannot logout on vc/1. Note that removing the rl4 file as soon as it is found is very important as you otherwise risk starting screen sessions inside of screen session causing all kinds of weird behaviour.

== See Also ==

== See Also ==

Revision as of 07:56, 5 September 2008

GNU Screen is a wrapper that allows separation between the text program and the shell from which it was launched. This allows the user to, for example, start a text program in a terminal in X, kill X, and continue to interact with the program. Here are a couple of tips and tricks you may be interested in.

Turn welcome message off

Cause it's annoying. Add to ~/.screenrc:

startup_message off

Add a GRUB entry to boot into Screen

If you mostly use X but occasionally want to run a Screen-as-window-manager session, here's a (somewhat clumsy way) to do it. It lets inittab create a small file, the presence of which tells .bashrc to start a screen session.

GRUB allows you to designate what runlevel you want so we'll use runlevel 4 for this purpose. Clone an appropriate GRUB entry and add a '4' to the kernel boot parameters list, like so:

The inittab line segments are separated by colons. The first part (scr*) is simply an id. The second part is the runlevel: This should only happen on runlevel 4 (which isn't used in any default setup - 3 is by default for a tty login and 5 is for X). 'Once' signifies that it shouldn't be repeated in case the user logs out, and 'respawn' is the opposite: if the user logs out, init repeats the command. The first command simply creates a 'flag file' to be picked up later by .bashrc. It is made (sudo -u) in the user's name so the user can delete it later.
The second command uses mingetty to automatically login some user to a virtual console on startup. You will need to install the mingetty package (AUR). The mingetty command respawns on vc/1 (virtual console 1 - the one you get when you ctrl+alt+f1) so we'll need to see that nothing else happens on virtual console 1 when we use runlevel 4. Remove '4' from the the first of the agetty lines:

c1:235:respawn:/sbin/agetty -8 38400 vc/1 linux

Once logged in we want to ensure that screen is started. This is where the flag file becomes relevant. Add the follwoing to the end of your .bashrc:

This checks for the presence of the flag file and if found, will launch a screen session immediately after the autologin. Quitting the screen session simply gives you a prompt but due to mingetty respawning you cannot logout on vc/1. Note that removing the rl4 file as soon as it is found is very important as you otherwise risk starting screen sessions inside of screen session causing all kinds of weird behaviour.