# Scripts to run the Application

In this section scripts to manage the Web Application will be explained.

Prerequisites:

* GemStone/S installed and running
* BPM application installed.

For more technical information about Gem processes used in these scripts see:

[https://github.com/GsDevKit/gsApplicationTools/blob/master/docs/gettingStarted.md](https://github.com/GsDevKit/gsApplicationTools/blob/master/docs/gettingStarted.md)

**Prerequisites**:

The scripts/shell commands can be found in **$GS\_HOME/shared/repos/BpmFlow** directory.

In order to use these scritps the Shell session must have defined the environment variable \[GS\_HOME]. To set this variable the following bash code can be executed:

```
export GS_HOME=/home/gemstone/GsDevKit_home
export PATH=$GS_HOME/bin:$PATH
```

Where \[**gemstone**] is the name of the **Linux** user and \[**GsDevKit\_home**] is where **GemStone/S DevKit** has been installed.

### **List of Scripts** <a href="#list-of-scripts" id="list-of-scripts"></a>

The whole project is installed at:\
&#xNAN;**/home/linux-user-name/GsDevKit\_home/shared/repos/BpmFlow**

There are six scripts or shell command in order to **manage** the **Web Application:**

**install-all.sh** stoneName\
Install all components of **BPM Flow** on **GemStone/S** named "stoneName".\
`$ sh install-all.sh devKit_351`

**register-application.sh** stoneName\
`$ sh register-application.sh devKit_351`\
Register the Web Server to serve requests on **GemStone/S** named "stoneName". This shell command has to be **executed only once**. \
This script read data in _**ports-all.ini**_ file and register all ports in this file. For example if _**ports-all.ini**_ has the following content: 8787,8888,8989

This will register the Web Application to be used in ports: _8787,8888,8989_. Comma is used to separate ports. The **ini**'s files are in the same directory as the scripts.

**unregister-application.sh** stoneName\
`$ sh unregister-application.sh devKit_351`\
To unregister the Web Server on **GemStone/S** named "stoneName". This shell command has to be used in coordination with `register-application.sh` script.

**start-all.sh** stoneName\
`$ sh start-all.sh devKit_351`\
This command will start a **multi-thread** Web Application Server on **GemStone/S** named "stoneName" where each port will be attended by a different (**Gem**) process. Following the previous example three **Gem processes** will be created to attend each port. \
The ports to be attended are defined in _**ports-all.ini**_. At registration time (**register-application.sh**) there is a list of ports in _**ports-all.ini**_ and each will be active when this script is executed.\
\
After executing this script some **pid** and **log** files will be create at **$GS\_HOME/server/stones/devKit\_34/logs/**. In this case is the path includes **devKit\_34** because the **Stone** was created with that name. The  **pid** and **log** files will be like _**BPM\_server-8787.log**_ and _**BPM\_server-8787.pid**_. A pair of these file will be create per each port defined in _**ports-all.ini**_.

**stop-all.sh** stoneName\
`$ sh stop-all.sh devKit_351`\
This command will stop all **Gem processes** serving the **Web Application** on all ports on **GemStone/S** named "stoneName". The **Web Application** will **no** longer answer http requests.

**start-on.sh** stoneName portNumber\
This command will start a **Gem Process** on **GemStone/S** named "stoneName" and port "portNumber". The port number argument must be defined in _**ports-all.ini**_ file. \
`$ sh start-on.sh devKit_351 8787`&#x20;

**stop-on.sh**\
This command will stop the **Gem Process** running on **GemStone/S** named "stoneName" and port "portNumber".\
`$sh stop-on.sh devKit_351 8787`

**start-zn.sh**\
`$sh start-zn.sh devKit_351`\
This command is similar to \[_start-all.sh_] but instead of starting a **Gem Process** for each port it only start a subset of all ports. The subset is defined in \[**zn-ports.ini**] file.

**stop-zn.sh**\
`$sh stop-zn.sh devKit_351`\
This command is similar to \[_stop-all.sh_] but instead of stop all **Gem Process** in each port it only stop a subset of all ports. The subset is defined in \[**zn-ports.ini**] file.

**start-timers-loop.sh**\
`$sh start-timers-loop devKit_351`\
This command will start a **Gem Process** to process all **Timers** in the system and should be execute only once.

**start-deferred-scripts-loop.sh**\
`$sh start-deferred-scripts devKit_351`\
This command will start a **Gem Process** to process all **deferred** **Scripts** in the system and should be execute only once.

More about **Timers** here:\
&#x20;[Timers](../functional-and-technical-information/timers)
