0

I am trying to run my node.js app using forever on windows 64 bit. I have tried the followed, i installed foreman from npm . App is started with foreman start app.js. I observe that the node is running with my account. When logged out of the box the process stops. Is there away to start foreman and node to run with a system account so that its always running with out associating node to a specific user.

Any help would be greatly appreciated. TIA

mklement0
  • 382,024
  • 64
  • 607
  • 775
tx fun
  • 569
  • 5
  • 19
  • That's just the way windows works... you must stay logged in and the machine must stay powered on for things to run. – Daniel Nov 12 '16 at 00:09

1 Answers1

0

You would need to run your app or forman either as a service or a scheduled task triggered to run at startup.

I found this package that will replace forever and install pm2 as a service. https://www.npmjs.com/package/pm2-windows-service

Using forever:

There is at least this Stackoverflow question covering creating a service and probably others. Question about creating a service from an exe

Creating a scheduled task tutorial

Open Task scheduler:

  • Use windows search or control panel/administrative tools/Task Scheduler
  • You can also open a cmd console and copy %windir%\system32\taskschd.msc /s into it and hit enter.

From there you can create a new task, set a schedule that triggers on startup, point it to forever and set it to run if your logged in or not. The link above, or other google results, will give you good tutorial info to work through it step by step.

Community
  • 1
  • 1
cmp-202
  • 312
  • 1
  • 5
  • PM2 was my first choice, going back to PM2. I tried the steps as suggested. ` npm install pm2 -g setx /M PM2_HOME d:\pm2\ set HOMEDRIVE=D: set PM2_HOME=d:\pm2 setx /M PM2_HOME d:\pm2`
    – tx fun Nov 13 '16 at 21:04
  • We used to use in a production environment but that was on linux and we were using multiple apps. Always found it very good but that package seemed an easier option. I had read that pm2 needed the enviroment veriables setting for it to work. – cmp-202 Nov 13 '16 at 21:16