Understanding what startup scripts do Despite all the (Web hosting contract)

December 24th, 2007

Understanding what startup scripts do Despite all the complicated rcXs, Ss, and Ks, the form of each start-up script is really quite simple. Because they are in plain text, you can just open one with a text editor to take a look at what it does. For the most part, a run-level script can be run with a start option, a stop option, and possibly a restart option. For example, the following lines are part of the contents of the smb script that defines what happens when the script is run with different options to start or stop the Samba file and print service: #!/bin/sh # # chkconfig: - 91 35 # description: Starts and stops the Samba smbd and nmbd daemons # used to provide SMB network services. # . . . start() { KIND=”SMB” echo -n $”Starting $KIND services: ” daemon smbd $SMBDOPTIONS RETVAL=$? echo KIND=”NMB” echo -n $”Starting $KIND services: ” daemon nmbd $NMBDOPTIONS RETVAL2=$? echo [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || RETVAL=1 return $RETVAL } stop() { KIND=”SMB” echo -n $”Shutting down $KIND services: ” killproc smbd RETVAL=$? echo KIND=”NMB”
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

network. syslog Starts or stops the (Zeus web server) klogd and

December 23rd, 2007

network. syslog Starts or stops the klogd and syslogd daemons that handle logging events from the kernel and other processes, respectively. xfs Starts or stops xfs, the X Window font server daemon. xinetd Sets the machine s hostname, establishes network routes, and controls xinetd, the network services daemon which listens for incoming TCP/IP connections to the machine. ypbind Binds to an NIS (Network Information Service) master server (if NIS is configured), and starts or stops the ypbind process, which communicates with the master server. Each script representing a service that you want to start or stop is linked to a file in each of the run-level directories. For each run level, a script beginning with K stops the service, whereas a script beginning with S starts the service. The two digits following the K or S in the filename provide a mechanism to select the priority in which the programs are run. For example, S30syslog is run before S40crond. However, while humans can readily see that 85 is less than 110, the file S110my_daemon is run before S85gpm. This is because the “ASCII collating sequence orders the files,” which simply means that one positional character is compared to another. Therefore, a script beginning with the characters S110 is executed between S10network and S15netfs in run level 3. All of the programs within the /etc/rcX.d directories (where X is replaced by a run-level number) are symbolic links, usually to a file in /etc/init.d. The /etc/rcX.d directories include the following: /etc/rc0.d: Run level 0 directory /etc/rc1.d: Run level 1 directory /etc/rc2.d: Run level 2 directory /etc/rc3.d: Run level 3 directory /etc/rc4.d: Run level 4 directory /etc/rc5.d: Run level 5 directory /etc/rc6.d: Run level 6 directory In this manner, /etc/rc0.d/K60atd, /etc/rc1.d/K60atd, /etc/rc2.d/K60atd, /etc/rc3.d/S40atd, /etc/rc4.d/S40atd, /etc/rc5.d/S40atd, and /etc/rc6.d/K60atd are all symbolic links to /etc/init.d/atd. Using this simple, consistent mechanism, you can customize which programs are started at boot time.
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Starts or (Web and email hosting) stops the dhcpd daemon, which automatically

December 23rd, 2007

Starts or stops the dhcpd daemon, which automatically assigns IP addresses to computers on a LAN. gpm Controls the gpm daemon, which allows the mouse to interact with console- and text-based applications. halt Terminates all processes, writes out accounting records, removes swap space, unmounts all file systems, and either shuts down or reboots the machine (depending upon how the command was called). httpd Starts the httpd daemon, which allows your computer to act as an HTTP server (i.e., to serve Web pages). iptables Starts the iptables firewall daemon, which manages any iptables-style firewall rules set up for your computer. keytable Loads the predefined keyboard map. killall Shuts down any subsystems that may still be running prior to a shutdown or reboot. kudzu Detects and configures new hardware at boot time. linuxconf Loads any customized linuxconf policies or modules, as well as a few default modules (for use with the linuxconf system configuration tool). lpd Controls the lpd line printer daemon that handles spooling printing requests. netfs Mounts or unmounts network (NFS, SMB, and NCP) file systems. network Starts or stops all configured network interfaces and initializes the TCP/IP and IPX protocols. nfs Starts or stops the NFS-related daemons (rpc.nfsd, rpc.mountd, rpc.statd, and rcp.rquotad) and exports shared file systems. pcmcia Loads or unloads modules, drivers, and programs (including the cardmgr daemon) to support PCMCIA cards (Ethernet adapters, modems, memory cards, etc.) in laptop computers. portmap Starts or stops the portmap daemon, which manages programs and protocols that utilize the Remote Procedure Call (RPC) mechanism. random Loads or saves the current state of the machine s random number generator s random seed to ensure more random randomness. reconfig Runs the anaconda reconfiguration screens during certain start-up situations (such as a reconfig request from the LILO boot prompt). routed Starts or stops the routed daemon, which controls dynamic-routing table updates via the Router Information Protocol (RIP). rstatd Starts or stops the rpc.rstatd daemon, which enables others on the network to probe the machine for performance statistics. rusersd Starts or stops the rpc.rusersd daemon, which enables others on the network to locate users on the machine. rwhod Starts or stops the rwhod daemon, which enables others on the network to obtain a list of all currently logged-in users. sendmail Controls the sendmail daemon, which handles incoming and outgoing SMTP (Simple Mail Transport Protocol) mail messages. single Terminates all running processes and enters run level 1 (single-user mode). smb Starts or stops the smbd and nmbd daemons for allowing access to Samba file and print services. snmpd Starts or stops the snmpd (Simple Network Management Protocol) daemon, which enables others to view machine-configuration information. squid Starts or stops the squid services, which enables proxy service to clients on your
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Linux web host - all daemons or server processes that should be

December 22nd, 2007

all daemons or server processes that should be running in the new run level. This loop performs the same checks to ignore broken links and files lingering from previous RPM package installations. Also, the rc script will not attempt to start a daemon if its lock files in the /var/lock/subsys directory exist, indicating that the daemon is already running. The next block of code implements the aforementioned daemon startup confirmation process, prompting the user to type y, Y, or the Enter key to start the daemon; n or N to refrain from starting the daemon; or c or C to proceed with a normal, nonconfirmed startup sequence. Again, the script that is about to run is checked for a reference to the daemon or action procedures from the /etc/init.d/functions file. If such a reference exists (or if the script about to run is halt or reboot, the scripts that alter the run level), some variables are unset (LANG, LC_ALL, TEXTDOMAIN, and TEXTDOMAINDIR) and the script will be called with start as a command-line argument. This mechanism ensures that the output on the console is consistent for all daemons that are started. When that loop completes, all daemons that should be running at that run level will have been started. The rc script then terminates. Using run level 3 as an example of a common run level to start up your system (as set by the initdefault described earlier), the rc script traverses the /etc/rc3.d directory. It first looks for any program (most likely a shell script) with a name beginning with K. It runs each of these in turn, giving it an argument of stop, with the intention of killing the named processes. It then executes all programs that begin with S, using an argument of start, to run the named processes. Note The other common start-up run level for a Linux workstation is run level 5. The main difference between 3 and 5 is that the GUI starts at level 5 while you are just in command mode at level 3. (To start the GUI while you are in run level 3, type startx.) Understanding run-level scripts A software package that has a service that needs to start at boot time (or when the system changes to any run level) can add a script to the /etc/init.d directory. That script can then be linked to an appropriate run-level directory and either be started or stopped (to start or stop the service). Table 12-6 lists many of the typical run-level scripts that are found in /etc/init.d, and explains their function. Depending on the Red Hat Linux software packages you installed on your system, you may have dozens more run-level scripts than you see here. (Later, I describe how these files are linked into particular run-level directories.) Table 12-6: Run-Level Scripts Contained in /etc/init.d Run-Level Scripts What Does It Do? apmd Controls the Advanced Power Management daemon, which monitors battery status, and which can safely suspend or shut down all or part of a machine that supports it. atd Starts or stops the at daemon to receive, queue, and run jobs submitted via the at or batch commands. (The anacron run-level script runs at and batch jobs that were not run because the computer was down.) autofs Starts and stops the automount daemon, for automatically mounting file systems (so, for example, a CD can be automatically mounted when it is inserted). crond Starts or stops the cron daemon to periodically run routine commands. dhcpd
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

unset LANG unset LC_ALL unset TEXTDOMAIN unset TEXTDOMAINDIR (Web site hosting)

December 22nd, 2007

unset LANG unset LC_ALL unset TEXTDOMAIN unset TEXTDOMAINDIR exec $i start fi $i start else action “Starting $subsys” $i start fi fi done fi As with the inittab file, lines beginning with a # character are considered comments. Well, almost: The first line indicates that a unique instance of /bin/bash will be run for the execution of the script. The first noncommented lines deal with past, present, and future run levels. The variable argv1 takes on the value of the first (and only) command-line argument ($1). This represents the desired run level. The set command places the output of the runlevel command (explained later in this section) into $1 and $2, which are then distributed to the previous (the previous run level) and runlevel (the current run level) variables. The next line reads /etc/init.d/functions, which contains several segments of shell script code (such as the action, killproc, and confirm subroutines) used to provide a consistent interface for each process started from the rc script. If the confirm option is passed to the boot loader at boot time, no daemons or server processes will start without first being confirmed by a user at the system console. This next block of code checks if processes will need to be confirmed and sets the CONFIRM variable appropriately. In the next line, if the first part evaluates to a true (0) value (the value of $1 does not equal a null string), the second part following the && is run. The run-level variable is set to the desired run level as stored in the variable argv1. In the same manner on the next line, if the directory /var/run exists, the /var/run/runlevel.dir is created or overwritten. This file will contain the name of the directory that contains the commands about to be run (i.e., /etc/rc3.d). The next block begins by checking if that directory exists, terminating if it does not. At this point, the program begins the loop where all scripts in the run-level directory that begin with the letter K (representing those programs that should be stopped in the new run level) are run. Various checks are performed, skipping over such things as broken symbolic links (where the actual file to which the link points no longer exists) and files left around as conflicts when new RPM packages are installed over existing files that had been modified. In the line beginning with subsys=, conditional parameter expansion is performed within the curly braces ({}), removing the regular expression following the # from the variable specified before it. For example, if the value of the variable $i was /etc/rc3.d/K60lpd, the resultant value stored in the variable subsys would be lpd. The rc script will not attempt to kill a daemon if its lock files in the /var/lock/subsys directory do not exist, indicating that the daemon is not running. The next block of code checks whether the script that is about to run contains a reference to the killproc or action procedures as defined in the /etc/init.d/functions file. If such a reference exists, the script is called with stop as a command-line argument. Otherwise, the action procedure is called directly. Using this mechanism ensures that the output on the console is consistent for all daemons that are stopped. At the end of that loop, all daemons that should not be running in the new run level will have been terminated. The next loop similarly cycles through the files in the same directory that begin with the letter S, representing
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Ipower web hosting - # Don t run [KS]??foo.{rpmsave,rpmorig} scripts [ “${i%.rpmsave}” !=

December 21st, 2007

# Don t run [KS]??foo.{rpmsave,rpmorig} scripts [ “${i%.rpmsave}” != “${i}” ] && continue [ “${i%.rpmorig}” != “${i}” ] && continue [ “${i%.rpmnew}” != “${i}” ] && continue # Check if the subsystem is already up. subsys=${i#/etc/rc$runlevel.d/K??} [ ! -f /var/lock/subsys/$subsys ] && [ ! -f /var/lock/subsys/${subsys}.init ] && continue # Bring the subsystem down. if egrep -q “(killproc |action )” $i ; then $i stop else action “Stopping $subsys” $i stop fi done # Now run the START scripts. for i in /etc/rc$runlevel.d/S*; do # Check if the script is there. [ ! -f $i ] && continue # Don t run [KS]??foo.{rpmsave,rpmorig} scripts [ “${i%.rpmsave}” != “${i}” ] && continue [ “${i%.rpmorig}” != “${i}” ] && continue [ “${i%.rpmnew}” != “${i}” ] && continue # Check if the subsystem is already up. subsys=${i#/etc/rc$runlevel.d/S??} [ -f /var/lock/subsys/$subsys ] || [ -f /var/lock/subsys/${subsys}.init ] && continue # If we re in confirmation mode, get user confirmation [ -n “$CONFIRM” ] && { confirm $subsys case $? in 0) : ;; 2) CONFIRM= ;; *) continue ;; esac } # Bring the subsystem up. if egrep -q “(daemon |action )” $i ; then if [ “$subsys” = “halt” -o “$subsys” = “reboot” ]; then unset LANG unset LC_ALL unset TEXTDOMAIN unset TEXTDOMAINDIR exec $i start else $i start fi else if [ “$subsys”= “halt” -o “$subsys” = “reboot” -o “$subsys” = “single” -o “$subsys” = “local” ]; then if [ “$subsys” = “halt” -o “$subsys” = “reboot” ]; then
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Web and email hosting - System Start-up and Shutdown During system start-up, a

December 21st, 2007

System Start-up and Shutdown During system start-up, a series of scripts are run to start the services that you need. These include scripts to start network interfaces, mount directories, and monitor your system. Most of these scripts are run from subdirectories of /etc/rc.d. The program that starts most of these services up when you boot and stops them when you shut down is the /etc/rc.d/rc script. The following sections describe run-level scripts and what you can do with them. Starting run-level scripts As previously mentioned, the /etc/rc.d/rc script is a script that is integral to the concept of run levels. Any change of run level causes the script to be executed, with the new run level as an argument. This simple yet powerful script is shown and discussed here: #!/bin/bash # # rc This file is responsible for starting/stopping # services when the runlevel changes. It is also # responsible for the very first setup of basic # things, such as setting the hostname. # # Original Author: # Miquel van Smoorenburg, # # Now find out what the current and what the previous runlevel are. argv1=”$1″ set `/sbin/runlevel` runlevel=$2 previous=$1 export runlevel previous # Source function library. . /etc/init.d/functions # See if we want to be in user confirmation mode if [ “$previous” = “N” ]; then if grep -i confirm /proc/cmdline >/dev/null || [ -f /var/run/confirm ] ; then rm -f /var/run/confirm CONFIRM=yes else CONFIRM= echo “Entering non-interactive startup” fi fi export CONFIRM # Get first argument. Set new runlevel to this argument. [ “$1″ != “” ] && runlevel=”$argv1″ # Tell linuxconf what runlevel we are in [ -d /var/run ] && echo “/etcrc$runlevel.d” > /var/run/runlevel.dir # Is there an rc directory for this new runlevel? if [ -d /etc/rc$runlevel.d ]; then # First, run the KILL scripts. for i in /etc/rc$runlevel.d/K*; do # Check if the script is there. [ ! -f $i ] && continue
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Web server type - connection, this is a good choice for initdefault.

December 20th, 2007

connection, this is a good choice for initdefault. 3, 4 Multiuser mode with network services. Run level 3 is the typical value for initdefault on a Red Hat Linux server, but run level 4 (generally left to be user-defined) is almost identical in a default Red Hat 7.0 Linux configuration. 5 Multiuser mode with network services and X. This run level starts the X server and presents a graphical login window, visually resembling any of the more expensive UNIX-based workstations. This is a common initdefault value for a Red Hat Linux workstation. 6 All processes are terminated and the machine is gracefully rebooted. Again, the comments in the inittab file mention that this is not a good choice for initdefault, perhaps even worse than run level 0. The effect is a possibly infinite cycle of booting, followed by rebooting. 7, 8, 9 Generally unused and undefined, these run levels have the potential to meet any needs not covered by the default options. a, b, c, A, B, C Used in conjunction with the ondemand action. These don t really specify a run level but can launch a program or daemon “on demand” if so instructed. Note If there is no initdefault specified in the inittab file, the boot sequence will be interrupted and you will be prompted to specify a default run level into which the machine will boot. The next line in the inittab file instructs init to execute the /etc/rc.d/rc.sysinit script before entering the default run level. This script performs many initialization routines such as choosing a keymap file, checking and mounting the root and proc file systems, setting the clock and hostname, configuring swap space, cleaning up temporary files, and loading system modules. The seven following lines control the commands executed within each major run level. In each, the /etc/rc.d/rc script is called, using the desired run level as an argument. It, in turn, descends into the appropriate directory tree (for example, the /etc/rc3.d directory is entered for run level 3). The next line specifies that no matter what run level the machine is in, the update daemon should be running. The update daemon is a program that flushes kernel buffers from memory to disk (generally every 30 seconds) to ensure that, in the event of an unintended shutdown, a minimum amount of data is lost. The ctrlaltdel tells init to perform exactly what PC users would expect if the Ctrl, Alt, and Delete keys were pressed simultaneously. The system reboots itself in an orderly fashion (a switch to run level 6) after a three-second delay. The next two lines (with their comments) deal with graceful shutdowns if you have an uninterruptible power supply (UPS) and software installed. The first line initiates a halt (a switch to run level 0) two minutes after receiving a signal from the UPS indicating a power failure. The second line cancels the shutdown in the event that power is restored. The six getty lines start up virtual consoles to allow logins. These processes are always running in any of the multiuser run levels. When someone connected to a virtual console logs out, that getty process dies, and the respawn action instructs init to start a new getty process. The last line indicates that as long as the system is in run level 5, the preferred display manager (xdm, gnome, KDE, etc.) will be running. This presents a graphical login prompt rather than the usual text-based login, and eliminates the need to run startx.
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

My space web page - wait The same as once, but init waits

December 20th, 2007

wait The same as once, but init waits for the command to finish before continuing with other inittab entries. respawn The process is monitored, and a new instance is started if the original process terminates. powerfail The command is executed on receiving a SIGPWR signal from software associated with an UPS unit. powerwait The same as powerfail, but init waits for the command to finish. powerwaitok The command is executed on receiving a SIGPWR signal if the /etc/powerstatus file contains the word OK. This is generally accomplished by the UPS software, and indicates that a normal power level has been restored. ondemand The command is executed when init is manually instructed to enter one of the special run levels a, b, or c (equivalent to A, B, and C, respectively). No change in run level actually takes place. The program is restarted if the original process terminates. sysinit The command is executed during the system boot phase; the runlevelsfield is ignored. boot The command is executed during the system boot phase, after all sysinit entries have been processed; the runlevels field is ignored. bootwait The same as boot, but init waits for the command to finish before continuing with other inittab entries; the runlevels field is also ignored. initdefault The run level to enter after completing the boot and sysinit actions. off Nothing happens (perhaps useful for testing and debugging). ctrlaltdel Traps the Ctrl+Alt+Del key sequence, and is typically used to gracefully shut down the system. kbrequest Used to trap special key sequences, as interpreted by the keyboard handler. Breakdown of the inittab file Because the inittab file is a configuration file and not a sequential shell script, the order of lines is not significant. Lines beginning with a # character are considered comments and are not processed. The first noncommented line in the preceding sample inittab file sets the default run level to 3. A default of 3 means that, following the completion of all commands associated with the sysinit, boot, and bootwait actions, run level 3 will be entered (booting to a text-based login). The other common initdefault level is run level 5 (booting to a GUI). Table 12-5 describes each of the run levels and helps you choose the run level that is best suited as the default in your environment. Table 12-5: Possible Run Levels Run Level What Happens in This Run Level 0 All processes are terminated and the machine comes to an orderly halt. As the inittab comments point out, this is not a good choice for initdefault, because as soon as the kernel, modules, and drivers are loaded, the machine will halt. 1, s, S This represents single-user mode, which is most frequently used for system maintenance and in situations where it may be preferable to have few processes running and no services activated. In single-user mode, the network is nonexistent, the X server is not running, and it is possible that some file systems are not mounted. 2 Multiuser mode. Multiple user logins are allowed, all configured file systems are mounted, and all processes except X, the at daemon, the xinetd daemon, and NIS/NFS are started. If your machine doesn t have (or perhaps doesn t need) a permanent network
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

# id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 (Web design online)

December 19th, 2007

# id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 # Things to run in every runlevel. ud::once:/sbin/update # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 “Power Failure; System Shutting Down” # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c “Power Restored; Shutdown Cancelled” # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 # xdm is now a separate service x:5:respawn:/etc/X11/prefdm -nodaemon Format of the inittab file The plain-text inittab file consists of several colon-separated fields in the format: id:runlevels:action:command The id field is a unique identifier, one to four alphanumeric characters in length that represents a particular action to take during system start-up. The run levels field contains a list of run levels in which the command will be run. Common run levels are 0, 1, 2, 3, 4, 5, and 6 (s and S represent single-user mode, which is equivalent to 1). Run levels 7, 8, and 9 are not standard; they can also be used as the special run levels associated with the on demand action (a, b, and c, which are equivalent to A, B, and C). The next field represents the type of action to be taken by init (valid actions and the results of those actions are listed in Table 12-4), and the last field is the actual command that is to be executed. Table 12-4: Valid init Actions Action How the Command Is Run once The command is executed once when entering the specified run level.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.