[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripting



john gennard wrote:
I'm trying to understand Debian's startup procedure and
follow the relevant scripts. Where can I find a tutorial
on scripting?

For example, /etc/init.d/rc - I can roughly understand
what is happening (the comments often indicate the way), but
the finer points are obscure. I've found a tutorial written
in 2000 and a number of other things which appear to relate
to bash scripting, but none show many of the words used in
/etc/init.d/rc. Does each Distro create it's own words?

I realise I shall not become expert, but that's no reason not
to try to reach a certain level. Can someone indicate the way
to a 'beginners guide/tutorial'? A direct reply would be
appreciated - I've been subscribed to the list for ten years,
but have recently been forced to unsubscribe (over 100 OT
posts per day has become too much for me to deal with on dial-up).

John.



Hi, John,

OK, now that I know what the "abs-guide" is all about, let me try and provide some pointers and suggestions.

The first one is the same as what most others have suggested, which is to become familiar with shell scripting techniques. Besides the guide already mentioned, there are a number of good books you may find useful. My favorite (though perhaps best read after some other, more basic text) is 'The UNIX Programming Environment', by Kernighan and Pike. This covers a lot more than shell scripting, however, and may not be useful if you are not interested in other features of UNIX and UNIX-like systems.

The scripting stuff will take care of much of the content of the rc file you mentioned, though not all. This is just one of many files in /etc/init.d, all of which play some role in getting your system up and running (more on this below). Focusing for a moment on it, I did see a number of 'words' that are, so to speak, outside the general concept of 'scripting'. These, in most cases, are other programs being run by the script, for example 'stty'. So, besides a good introduction to scripting, you will need a good introduction to system administration and ready access to the man pages, so you can figure out what these 'words' are doing. Debian has a bunch of guides for administration, beginning with 'debian-reference-common' and moving through many application specific guides. An 'apt-cache search administration' will get you a list of at least 143 such documents.

As a quick aside, think of a script as a container that glues various standalone programs and applications together, to accomplish some specific task(s). You need knowledge of both scripting (the 'control' language) and the functions of those programs and their command 'language' (options, arguments, environment, etc.) in order to understand and write useful scripts.

Finally, and still part of the 'system administration' part, you need to find and study any documentation you can on how the SysVinit setup works. Unfortunately, in part due to its flexibility and in part to the need for commercial Gnu/Linux releases to 'differentiate' from each other, no two systems implement this in quite the same way. Since you're looking at a Debian environment, begin by looking at the /etc/init.d/README file, which provides links to Debian manuals describing how these scripts work to start and stop daemons, do one time system configuration on booting, and so forth.

Finally, take it easy, don't rush through this. Use the lists to ask questions, when you get stuck.

Good luck and have fun!

Bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: