diff --git a/examples/all-env-vars.js b/examples/all-env-vars.js deleted file mode 100644 index 1ddf38a3..00000000 --- a/examples/all-env-vars.js +++ /dev/null @@ -1 +0,0 @@ -console.log(JSON.stringify(process.env)); \ No newline at end of file diff --git a/examples/always-throw.js b/examples/always-throw.js deleted file mode 100644 index 6562a488..00000000 --- a/examples/always-throw.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error('Dont spin restart') \ No newline at end of file diff --git a/examples/cli-multiple-start b/examples/cli-multiple-start deleted file mode 100755 index 02e2ce93..00000000 --- a/examples/cli-multiple-start +++ /dev/null @@ -1,4 +0,0 @@ -forever start test/fixtures/server.js -p 8080 -forever start test/fixtures/server.js -p 8081 -forever start test/fixtures/server.js -p 8082 -forever list \ No newline at end of file diff --git a/examples/count-timer.js b/examples/count-timer.js deleted file mode 100644 index 7a4aff9e..00000000 --- a/examples/count-timer.js +++ /dev/null @@ -1,8 +0,0 @@ -var util = require('util'); - -var count = 0; - -var id = setInterval(function () { - util.puts('Count is ' + count + '. Incrementing now.'); - count++; -}, 1000); diff --git a/examples/custom-cwd.js b/examples/custom-cwd.js deleted file mode 100644 index 9001e552..00000000 --- a/examples/custom-cwd.js +++ /dev/null @@ -1 +0,0 @@ -console.log(process.cwd()); \ No newline at end of file diff --git a/examples/env-server.js b/examples/env-server.js deleted file mode 100644 index a2295b8a..00000000 --- a/examples/env-server.js +++ /dev/null @@ -1,7 +0,0 @@ -var http = require('http'); - -http.createServer(function (req, res) { - res.writeHead(200, { 'Content-Type': 'application/json' }); - res.write(JSON.stringify(process.env)); - res.end(); -}).listen(8080); diff --git a/examples/env-vars.js b/examples/env-vars.js deleted file mode 100644 index 37b3938e..00000000 --- a/examples/env-vars.js +++ /dev/null @@ -1,4 +0,0 @@ -console.log(JSON.stringify({ - foo: process.env.FOO, - bar: process.env.BAR -})); \ No newline at end of file diff --git a/examples/error-on-timer.js b/examples/error-on-timer.js deleted file mode 100644 index 3b08b8ea..00000000 --- a/examples/error-on-timer.js +++ /dev/null @@ -1,6 +0,0 @@ -var util = require('util'); - -setTimeout(function () { - util.puts('Throwing error now.'); - throw new Error('User generated fault.'); -}, 200); diff --git a/examples/initd-example b/examples/initd-example deleted file mode 100644 index 7c54977c..00000000 --- a/examples/initd-example +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# initd-example Node init.d -# -# chkconfig: 345 80 20 -# description: Node init.d example -# processname: node -# pidfile: /var/run/initd-example.pid -# logfile: /var/log/initd-example.log -# - -# Source function library. -. /lib/lsb/init-functions - -NAME=initd-example # Unique name for the application -PORT=1234 # Port (in this case the application uses process.env.PORT to set the port) -INSTANCE_DIR=/var/www/$NAME # Location of the application source -SOURCE_NAME=main.js # Name os the applcation entry point script - -user=apache -pidfile=/var/run/$NAME.pid -logfile=/var/log/$NAME.log -forever_dir=/var/run/forever # Forever root directory. - -node=node -forever=forever -awk=awk -sed=sed - -start() { - echo "Starting $NAME node instance: " - - if [ "$id" = "" ]; then - # Create the log and pid files, making sure that the target use has access to them - touch $logfile - chown $user $logfile - - touch $pidfile - chown $user $pidfile - - # Launch the application - start_daemon - $forever start -p $forever_dir --pidFile $pidfile -l $logfile -a -d $INSTANCE_DIR $SOURCE_NAME - RETVAL=$? - else - echo "Instance already running" - RETVAL=0 - fi -} - -restart() { - echo -n "Restarting $NAME node instance : " - if [ "$id" != "" ]; then - $forever restart -p $forever_dir $id - RETVAL=$? - else - start - fi -} - -stop() { - echo -n "Shutting down $NAME node instance : " - if [ "$id" != "" ]; then - $forever stop -p $forever_dir $id - else - echo "Instance is not running"; - fi - RETVAL=$? -} - -getForeverId() { - local pid=$(pidofproc -p $pidfile) - $forever list -p $forever_dir | $sed -e 's/\x1b\[[0-9; ]*m//g' | $awk "\$6 && \$6 == \"$pid\" { gsub(/[\[\]]/, \"\", \$2); print \$2; }"; -} -id=$(getForeverId) - -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status -p ${pidfile} - ;; - restart) - restart - ;; - *) - echo "Usage: {start|stop|status|restart}" - exit 1 - ;; -esac -exit $RETVAL diff --git a/examples/list-multiple.js b/examples/list-multiple.js deleted file mode 100644 index 7d570c9a..00000000 --- a/examples/list-multiple.js +++ /dev/null @@ -1,37 +0,0 @@ -var path = require('path'), - async = require('utile').async, - forever = require('../lib/forever'); - -function startServer (port, next) { - var child = new (forever.Monitor) (script, { - options: [ '--port', port], - silent: true - }); - - child.start(); - child.on('start', function (_, data) { - console.log('Forever process running server.js on ' + port); - next(null, child); - }); -} - -// Array config data -var script = path.join(__dirname, 'server.js'), - ports = [8080, 8081, 8082]; - -async.map(ports, startServer, function (err, monitors) { - forever.startServer(monitors, function () { - // - // Now that the server has started, run `forever.list()` - // - forever.list(false, function (err, data) { - if (err) { - console.log('Error running `forever.list()`'); - console.dir(err); - } - - console.log('Data returned from `forever.list()`'); - console.dir(data) - }) - }); -}); \ No newline at end of file diff --git a/examples/multiple-processes.js b/examples/multiple-processes.js deleted file mode 100644 index 82902656..00000000 --- a/examples/multiple-processes.js +++ /dev/null @@ -1,12 +0,0 @@ -var util = require('util'), - path = require('path'), - forever = require('./../lib/forever'), - script = path.join(__dirname, 'server.js'); - -var child1 = new (forever.Monitor)(script, { 'options': [ "--port=8080"] }); -child1.start(); -util.puts('Forever process running server.js on 8080'); - -var child2 = new (forever.Monitor)(script, { 'options': [ "--port=8081"] }); -child2.start(); -util.puts('Forever process running server.js on 8081'); diff --git a/examples/process-send.js b/examples/process-send.js deleted file mode 100644 index 220f3cb7..00000000 --- a/examples/process-send.js +++ /dev/null @@ -1,6 +0,0 @@ - -setInterval(function () { - if (process.send) { - process.send({ from: 'child' }); - } -}, 1000) \ No newline at end of file diff --git a/examples/signal-ignore.js b/examples/signal-ignore.js deleted file mode 100644 index 466837f2..00000000 --- a/examples/signal-ignore.js +++ /dev/null @@ -1,8 +0,0 @@ -function noop() { - console.log('IGNORED!') -} -process.on('SIGTERM',noop); -process.on('SIGINT',noop); -setInterval(function(){ - console.log('heartbeat'); -}, 100); \ No newline at end of file diff --git a/examples/spawn-and-error.js b/examples/spawn-and-error.js deleted file mode 100644 index 02bc5d0c..00000000 --- a/examples/spawn-and-error.js +++ /dev/null @@ -1,18 +0,0 @@ -var util = require('util'), - path = require('path'), - spawn = require('child_process').spawn; - -var child = spawn('node', [path.join(__dirname, 'count-timer.js')], { cwd: __dirname }); - -child.stdout.on('data', function (data) { - util.puts(data); - //throw new Error('User generated fault.'); -}); - -child.stderr.on('data', function (data) { - util.puts(data); -}); - -child.on('exit', function (code) { - util.puts('Child process exited with code: ' + code); -});