Running multiple TriggerCMD Agent instances on a single machine
-
Hi Russ,
I'm wondering if it's possible to run multiple instances of the agent on a single machine. Basically, I want them to behave separately. I want one Alexa device to be tied into one instance. Do you have an idea how I can accomplish this?
Thanks,
-
@esaltat, you could make a batch file to run the agent that first sets the HOMEPATH variable to different folder that contains a .TRIGGERcmdData subfolder, then runs the agent.js with the --console parameter. Like this:
set HOMEPATH=\altagent cd %USERPROFILE%\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src node agent.js --console
The following data files would go in C:\altagent\.TRIGGERcmdData
token.tkn should contain a token for the account the agent.
computer.cfg should contain the computer ID for the agent.
commands.json should contain the commands for the agent. -
I'm getting this error when running the batch file
C:\Users\Administrator\Desktop>test.bat C:\Users\Administrator\Desktop>set HOMEPATH=\altagent C:\Users\Administrator\Desktop>cd C:\Users\Administrator\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src C:\Users\Administrator\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src>node agent.js --console Daemon install: false fs.js:922 return binding.mkdir(pathModule._makeLong(path), ^ Error: ENOENT: no such file or directory, mkdir 'C:\altagent\.TRIGGERcmdData' at Error (native) at Object.fs.mkdirSync (fs.js:922:18) at initFiles (C:\Users\Administrator\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src\agent.js:88:10) at consoleagent (C:\Users\Administrator\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src\agent.js:154:3) at Object.<anonymous> (C:\Users\Administrator\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src\agent.js:149:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3)
-
@esaltat , you need to create the c:\altagent folder first.
It's trying to create the .TRIGGERcmdData folder in that altagent folder and it doesn't exist.
-
@russ perfect! thank you so much!
-
Hi Russel,
One thing I notice when I leave the agent running for a period of time and when I run commands it doesn't seem to work. I have to restart the agent to make it work again. I have two agents running at the same time, I don't have issues with the other one.
-
@esaltat, does that consistently happen? I ask because there was an outage yesterday when my database server's drive filled up. I wonder if that caused it.
The agent is supposed to keep trying to reconnect, and it generally works, but I haven't tested that with 2 agents on one computer.
I'll start running a 2nd agent on my PC and see if I can reproduce it.
-
@russ It only happened today but right now it seems to be running smoothly after I restarted the agent 3 times today. I'll keep you posted if it stops working again.
-
@russ It happened again today, I have to hit enter to the command line for the agent to pick up commands. I don't mind restarting agents every now and then but do you have an idea how to schedule a task to restart agents every 24 hours? Thank you
-
@esaltat, please clarify - the agent stops working until you hit enter in the cmd window that's running your 2nd agent? Or are you saying when you remotely run a command on that agent, it waits until you press enter? Please clarify. That pressing enter thing might be a clue.
I've had my 2nd agent running on my PC for about 21 hours now with no issue yet.
Also, can you run this command and tell me which version of node you're running? I'll try running the same version:
node -v
-
When I remotely run a command on the agent (from echo dot or triggercmd panel), it waits until I press enter. However, if I restart the agent, I don't have to press enter and it works just fine.
It's weird that it only happens when I leave the agent running for a period of time, in this case 24 hours.
I'm not sure if I have nodejs installed on my Windows computer so I can't see which version I am using.
Thanks for the fast response!
-
@esaltat, I still haven't been able to reproduce that problem. My 2nd agent never waits until I press enter. Do you have another computer you could try it on?
I realize now that you're using node.exe from this folder, which is fine. I'm using the same and it's working for me.
%USERPROFILE%\AppData\Local\TRIGGERcmdAgent\app-1.0.25\resources\app\src -
Sorry for the late reply, I didn't get any issues in the past few days, It seems to be completely working fine right now. Thanks for the help!