http://www.extremetech.com/article2/0,1697,1156371,00.asp


#
# Example.com (/etc/apache2/sites-available/www.example.com)
#
ServerAdmin webmaster@example.com
ServerName www.example.com
ServerAlias example.com
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/
Options +ExecCGI
# Logfiles
ErrorLog /home/www/www.example.com/logs/error.log
CustomLog /home/www/www.example.com/logs/access.log combined
Lastly, run (sudo) a2ensite www.example.com
Restart Apache2 and test out the URL.
#ref: http://www.debian-administration.org/articles/412
| Runlevel | Scripts Directory (Red Hat/Fedora Core) | State |
|---|---|---|
| 0 | /etc/rc.d/rc0.d/ | shutdown/halt system |
| 1 | /etc/rc.d/rc1.d/ | Single user mode |
| 2 | /etc/rc.d/rc2.d/ | Multiuser with no network services exported |
| 3 | /etc/rc.d/rc3.d/ | Default text/console only start. Full multiuser |
| 4 | /etc/rc.d/rc4.d/ | Reserved for local use. Also X-windows (Slackware/BSD) |
| 5 | /etc/rc.d/rc5.d/ | XDM X-windows GUI mode (Redhat/System V) |
| 6 | /etc/rc.d/rc6.d/ | Reboot |
| s or S | Single user/Maintenance mode (Slackware) | |
| M | Multiuser mode (Slackware) |
Adding a script to the /etc/rc.d/rc#.d/ directory with either an S or K prefix, adds the script to the boot or shutdown process. The scripts are run in numerical order. S20abc is run before S30xyz. The extensibility to the boot and shutdown procedures of the operating system is one of the strengths of UNIX. The orderly sequential initiation of processes can be coordinated for dependent processes. The orderly shutdown of processes is often required of complex programs such as databases. This is how it is done. Individual processes may be monitored, shutdown and started at any time using these scripts. i.e. /etc/rc.d/rc2.d/httpd start. The modifiers start, stop or status may be used.
The start/stop/status scripts actually reside in the directory:
0 3 * * * /root/backup.sh >/dev/null 2>&1| Special string | Meaning |
| @reboot | Run once, at startup. |
| @yearly | Run once a year, "0 0 1 1 *". |
| @annually | (same as @yearly) |
| @monthly | Run once a month, "0 0 1 * *". |
| @weekly | Run once a week, "0 0 * * 0". |
| @daily | Run once a day, "0 0 * * *". |
| @midnight | (same as @daily) |
| @hourly | Run once an hour, "0 * * * *". |