# grunt-forever

> Grunt task for starting and stopping an application as a daemon using forever

Latest version **0.4.7** (published 2015-04-16) · 0 weekly downloads

## Install

```sh
npm install grunt-forever
pnpm add grunt-forever
yarn add grunt-forever
bun add grunt-forever
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.7 |
| Published | 2015-04-16 |
| First published | 2012-10-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Todd Anderson |
| Maintainers | toddanderson, bustardcelly |
| Keywords | forever, forevergrunt, grunt, gruntplugin, plugins, daemon |

## Links

- npm: https://www.npmjs.com/package/grunt-forever
- Repository: https://github.com/bustardcelly/grunt-forever
- Issues: git://github.com/bustardcelly/grunt-forever/issues
- npm.io page: https://npm.io/package/grunt-forever

## Dependencies (1)

- [forever](https://npm.io/package/forever.md) ^0.14.1

## Recent versions

- 0.4.7 (latest) — 2015-04-16
- 0.4.6 — 2015-04-16
- 0.4.5 — 2014-09-17
- 0.4.4 — 2014-03-14
- 0.4.3 — 2014-03-13
- 0.4.2 — 2014-02-25
- 0.4.1 — 2013-06-12
- 0.4.0 — 2013-02-28
- 0.2.2 — 2012-10-11
- 0.2.1 — 2012-10-11
- 0.2.0 — 2012-10-11
- 0.1.0 — 2012-10-11

## README

grunt-forever
=============

> forever task for grunt to start, stop and restart an application as a daemon.

[![Build Status](https://travis-ci.org/bustardcelly/grunt-forever.png?branch=master)](https://travis-ci.org/bustardcelly/grunt-forever)

## Updated for Grunt 0.4.0
This grunt task plugin has been updated to work with [Grunt 0.4.0](https://github.com/gruntjs/grunt/wiki/Getting-started) release. The working version for Grunt 0.3.x has been tagged [0.2.2](https://github.com/bustardcelly/grunt-forever/tree/0.2.2).

## Getting Started
Install this grunt plugin next to your project's [grunt.js gruntfile](https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md) with: 

```
$ npm install grunt-forever
```

Then add this line to your project's `grunt.js` gruntfile:

```javascript
grunt.loadNpmTasks('grunt-forever');
```

## Tests
There are several specs verifying the `start`, `stop` and `restart` commands for the task. To run the feature specs:

```
$ npm run test
```

### Overview

Inside your `grunt.js` file add a section named `forever`. This section specifies the `forever` task and provides the main application filepath option that will be run. The main filepath defaults to `index.js` if not provided.

#### Named Arguments
grunt-forever uses colon-separated arguments for the `forever` task described in the [grunt API](https://github.com/gruntjs/grunt/wiki/grunt.task#wiki-grunt-task-registerTask). Supported name arguments are:

* forever:<target>:start
* forever:<target>:stop
* forever:<target>:restart

##### start

Attempts to start the main application file as a daemon if not currently running.

##### stop

Attempts to stop the process started previously by `forever`.

##### restart

Attempts to restart the process previously started. If not currently running, starts a new one.

#### Options

##### index ```string```

The option specifies the main application file that will be run under a daemon using `forever`.

##### command ```string```

The command to execute, defaults to 'node'. Set this to 'coffee' to run
coffeescript applications.

##### logDir ```string```

The directory log files are saved, defaults to 'forever'.

##### errFile ```string```

File stderr is logged into. If omitted, not generated.

##### outFile ```string```

File stdout is logged into. If omitted, not generated.

##### logFile ```string```

Logs the forever outiput to file. If omitted, not generated.

##### killSignal ```string```

Exit signal specification. Defaults to `SIGKILL`.

### Config Example
```javascript
forever: {
  server1: {
    options: {
      index: 'index.js',
      logDir: 'logs'
    }
  },

  server2: {
    options: {
      index: 'otherindex.js',
      logDir: 'logs'
    }
  }
}
```

### Command example
```bash
grunt forever:server1:start
```

```bash
grunt forever:server2:stop
```

```bash
grunt forever:server1:restart
```

---
_Source: https://npm.io/package/grunt-forever · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
