What is a .i file?

A .i file is a file that lets you start a service or program easily by using the ngc or ng-update commands.

Where are they located?

The .i files are located in the /etc/initng directory or subdirectories such as /etc/initng/system or /etc/initng/daemon.

Why would I want to edit or make one of these files?

Well the reason is simple what if you would like to have a program start on startup but currently there is no script for it. Or a program won't start yet there is a script so soon you will have the skills to edit and fix these files.

Notice: the file must end in .i or initng will not see it!

Basic Syntax:

Notice: The '=' is optional in all of the commands I list below, I added it because I think it looks cleaner but you can choose to use it or not as you see fit.

Naming the script (in the script).

Naming the service and doing the first required thing. The name of a service is the subfolder (not including /etc/initng) then the name of the program. 

Syntax:

folder/name

Example:

system/alsasound

The first line of code (always):

service folder/name {

Warning: Do not forget the { there it is very very very important!

Dependencies:

A dependency is something the program or service depends upon to execute properly.

Syntax:

need = "folder/nameofdependency" "folder/nameofdependency"

Example:

need = "system/initial" "system/modules"

Use:

If a service is in this runlevel it waits on it to finish.

Syntax:

use = folder/name

Example:

use = system/static-modules

Changing the directory:

The following command allows you to change the directory you are working in.

Syntax:

chdir = /path/to/dir

Example:

chdir = /root/initng

Chrooting:

This lets you change the root when running a command.

Syntax:

chroot = /path/to/dir

Example:

chroot = /root/initng

Delaying the start of a service/daemon:

There are two ways to delay the start of a daemon or service. The first argument called "delay" takes a number in seconds. The other way is "udelay" which takes an argument in microseconds.

Syntax:

delay = time //seconds
udelay = time //microseconds

Example:

delay = 10
udelay = 10

Running a service/daemon as another user:

In most cases running a service/daemon as the root user is stupid and dangerous. So to solve this inherent security risk initng allows you to run the service/daemon as another user.

Syntax:

setuid = username

Example:

setuid = jimmy

Setting a priority for a service/daemon:

Some things that are executed are less important or more important than others.

Syntax:

nice = number //must be an integer as in no decimal point

Example:

nice = 19

Starting a service:

To start a service you use the start command or function.

Syntax:

start = /path/to/executable

or

start{ /path/to/executable }

Example:

start = /opt/foldingathome/client1/foldingathome

or

start{ /opt/foldingathome/client1/foldingathome }

Passing arguments to a service before starting it:

This is where you would put the options you pass your programs.

Syntax:

start_args = args

Example:

start_args = -k

To stop a service you use the stop command or function.

Syntax:

stop = /path/to/executable

Example:

stop = /opt/foldingathome/client1/foldingathome

Passing arguments to a service when stopping it:

This is where the options to stop the program that you want to stop go

Syntax:

start_args = args

Example:

start_args = -P

To finish the .i file you are writing:

Simply put a } at the bottom of the file to finish up

Example .i file:

service net/firestarter {
need = net/eth0

start = /usr/bin/firestarter
stop = /usr/bin/firestarter

start_args = -s
stop_args = -p
}
