13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

456Chapter 20Open Source Web <str<strong>on</strong>g>Applicati<strong>on</strong></str<strong>on</strong>g> Serversstatus_at() {status /usr/sbin/atd}case "$1" instart)start;;stop)stop;;reload|restart)restart;;c<strong>on</strong>drestart)if [ -f /var/lock/subsys/atd ]; thenrestartfi;;status)status_at;;*)echo $"Usage: $0 {start|stop|restart|c<strong>on</strong>drestart|status}"exit 1esacexit $?exit $RETVALThis script is from a RedHat <strong>Linux</strong> system. Those comments at the topare a magic incantati<strong>on</strong> for the chkc<strong>on</strong>fig program that ships with that distributi<strong>on</strong>11 (and with Fedora Core). We’ll talk more about chkc<strong>on</strong>fig in the nextsecti<strong>on</strong>.As you can see, the basic premise is that when a daem<strong>on</strong> is started, theprocess ID is saved into a file. If the “stop” opti<strong>on</strong> is passed, the PID is lookedup and the process is killed. That’s the basic idea. But wait! There’s more!Each runlevel has a directory of scripts. Let’s look at the c<strong>on</strong>tents of sucha directory (Example 20.3).11. The RedHat chkc<strong>on</strong>fig program is c<strong>on</strong>ceptually similar to the <strong>on</strong>e in the IRIX operatingsystem.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!