2.5 Tips for Speeding up Slow Logins
When I first started using the C shell in the early 1980s, I made
incredible
.cshrc
and
.login
files (
2.2
)
with all kinds of nice customizations. Aliases, commands to check my
mail, calendar systems, shell scripts in the background to watch
things for me... boy, was this great! Except when I tried to log in,
that is. I was working on an overloaded VAX 11/750. Logging in could
take a few minutes, from when I got the The C shell seems (to me) to be pretty slow at reading long .cshrc and .login files - especially at setting aliases. So, I learned some ways to get logged in faster. They were especially nice when I was at someone else's terminal and needed to log in for something quick. You might not want to use these exact techniques, but I hope they'll give you some ideas if your logins take too long. The same ideas will work on other shells - but with that shell's commands and syntax, of course. 2.5.1 Quick LoginAdd a "quick login" setup to the top of your .cshrc . As soon as the C shell starts and sets a few essentials, this setup asks whether you want a prompt right away. If you answer yes, it starts another C shell with the -f option (important: this makes the subshell ( 38.4 ) skip your .cshrc so you don't get a loop):
login:
From there, I can run a few quick commands.
Typing CTRL-d or Here's the top of the .cshrc file to set that up:
2.5.2 A Second Alias and Command File
Maybe you have a set of aliases or setup commands that you use only for
certain projects.
If you don't need that setup every time you log in, you can put the
setup commands in a separate file.
Make an alias named something like
setup
that reads the file into your
setup shell.
Only type Here's the alias:
and the start of the ~/lib/cshrc2 file:
set setup # variable to stop re-sourcing alias foo bar ... The first line in the cshrc2 file sets a shell variable that keeps the setup alias from re-reading the file into this shell. This saves time if you forget that you've already run setup . 2.5.3 Once-a-Day SetupMaybe there are some commands that you want to run only once a day, the first time you log in. For example, I had a reminder system that showed my calendar for the day, reminded me of birthdays, etc. A test like this in .login handles that:
That test uses
csh
arrays (
47.5
)
to get today's date and make
an empty file in my
tmp
directory with a name like
,setup.23
.
Once a file is created (say, on June 23), then the setup commands won't run
again that day.
I have a program that
periodically removes files named with a comma( - |
|