Creating an Init Script in Ubuntu 14.04

In Ubuntu, you create init scripts using the SysV init system. Details are here. In this article, I will create a very simple script to start and stop Tomcat.

Continue reading


Managing init Scripts in Ubuntu 13.04

Normally, I use chkconfig tool in SUSE or RedHat to manage init scripts. This tool is missing in Ubuntu. The alternative is to use the sysv-rc-conf tool.

First, install the tool:

sudo apt-get install sysv-rc-conf

To check the configuration of an init script, such as apache2, run:

sudo sysv-rc-conf --list apache2

To disable a script, such as apache2:

sudo sysv-rc-conf apache2 off

To enable it again:

sudo sysv-rc-conf apache2 on

To create a new script manually, use the same syntax as for chkconfig.

Nginx in Ubuntu 13.04 Quick Start Guide

1. Install Nginx:

sudo apt-get install nginx

2. Where are the files?

dpkg -L nginx-full

dpkg -L nginx-common

dpkg -L nginx

3. Starting and stopping:

cd /etc/init.d

sudo ./nginx start

sudo ./nginx stop

4. Go on a test drive. Start the server, then,

curl http://localhost

Default document root is /usr/share/nginx/html. Change index.html there and make sure changes are picked up by the server.

View the access log file: /var/log/nginx/access.log.

4. Edit basic settings like document root

vi /etc/nginx/sites-enabled/default

5. Edit advanced settings like worker process, log file location:

vi /etc/nginx/nginx.conf

Note: total number of HTTP requests served = worker_processes X worker_connections.