I just updated the scripts that TRIGGERcmd runs to have full paths, and now it works, thanks!
Posts made by Scott Barton
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ yes it's not using the full directory. Here is the adblock.sh script:
#/bin/ash echo running /scripts/adblock.sh now >> /tmp/adblock.log env >> /tmp/adenv.log pwd >> /tmp/adpwd.log case "$1" in "on") enableadblock echo /scripts/adblock.sh on ran >> /tmp/adblock.log ;; "off") disableadblock echo /scripts/adblock.sh off ran >> /tmp/adblock.log ;; *) echo "Run this with on or off as the parameter." exit 1 ;;
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ said in How do you install TRIGGERcmd on Raspberry pi with OpenWRT?:
pwd >> /tmp/pwd.log
I put those lines in both my starttriggercmd script and my adblock script.
When starting TRIGGERcmd automatically from the OpenWRT startup script I get the following for ENV:
HLVL=3
HOME=/
TERM=linux
PATH=/usr/sbin:/usr/bin:/sbin:/bin
PWD=/When I then run disableadblock command using Alexa I get the following for ENV:
SHLVL=5
HOME=/
NODE_TLS_REJECT_UNAUTHORIZED=0
TERM=linux
TCMD_COMPUTER_ID=5038e6811df15100191e57de
PATH=/usr/sbin:/usr/bin:/sbin:/bin
TCMD_COMMAND_ID=503962d2b77dfb0019ed137a
PWD=/gitrepo/TRIGGERcmd-Agent/srcIf I then disable TRIGGERcmd from autostart and reboot and run it manually from SSH (FYI, I was within the /tmp directory when I ran it) I get the following for ENV:
USER=root
SHLVL=2
HOME=/root
OLDPWD=/root
SSH_TTY=/dev/pts/0
PS1=[\e]0;\u@\h: \w\a]\u@\h:\w$
ENV=/etc/shinit
VISUAL=nano
LOGNAME=root
TERM=xterm
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/scripts
SHELL=/bin/ash
PWD=/tmp
EDITOR=nanoAnd then when I run the disableadblocker script using Alexa I get:
USER=root
SSH_CLIENT=192.168.2.2 51955 22
SHLVL=4
HOME=/root
OLDPWD=/root
SSH_TTY=/dev/pts/0
PS1=[\e]0;\u@\h: \w\a]\u@\h:\w$
ENV=/etc/shinit
VISUAL=nano
NODE_TLS_REJECT_UNAUTHORIZED=0
LOGNAME=root
TERM=xterm
TCMD_COMPUTER_ID=5038e6811df15100191e57de
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/scripts
TCMD_COMMAND_ID=503962d2b77dfb0019ed137a
SHELL=/bin/ash
PWD=/gitrepo/TRIGGERcmd-Agent/src
SSH_CONNECTION=192.168.2.2 51955 192.168.2.1 22
EDITOR=nano -
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ The log says it ran, but it doesn't do what it is supposed to do when the service is started automatically from the OpenWRT Local Startup script (/etc/rc.local). When I start the service from SSH using the exact same command that is in the startup script, it will run and do what it is supposed to do. However, if I close that SSH the service stops working. Both logs look exactly the same, but one actually executes and the other doesn't. I wonder if it is a permissions thing somehow?
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ I have the ground set to background in the /root/.TRIGGERcmdData/commands.json file. I did actually try changing it to foreground to see if it would work, but did not so I switched it back.
Thanks for your help!
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ I was able to get the service to start using OpenWRT. However when I use Alexa to issue commands, it says that it ran the command but doesn't seem to work (doesn't actually do what it was supposed to do). If I manually start the Triggercmd service from SSH and use Alexa to issue a command it works.
Here is the log:
Thu Mar 4 10:36:23 2021 daemon.notice procd: /etc/rc.d/S95done: Running Linux daemon to run background tasks.
Thu Mar 4 10:36:23 2021 daemon.notice procd: /etc/rc.d/S95done: Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
Thu Mar 4 10:36:23 2021 daemon.notice procd: /etc/rc.d/S95done: Tokenfile: /root/.TRIGGERcmdData/token.tkn
Thu Mar 4 10:36:23 2021 daemon.notice procd: /etc/rc.d/S95done: ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
Thu Mar 4 10:36:23 2021 daemon.notice procd: /etc/rc.d/S95done: Logging in with saved token to run background tasks.
Thu Mar 4 10:36:24 2021 daemon.notice procd: /etc/rc.d/S95done: (node:3088) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
Thu Mar 4 10:36:24 2021 daemon.notice procd: /etc/rc.d/S95done: (Usenode --trace-warnings ...
to show where the warning was created)
Thu Mar 4 10:36:24 2021 daemon.notice procd: /etc/rc.d/S95done: Write backup completed.
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done:
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done:
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: |> Now connected to https://www.triggercmd.com.
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: ___/ For help, see: http://bit.ly/2q0QDpf
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: (using sails.io.js node SDK @v1.2.1)
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: Connected at: Thu Mar 04 2021 10:36:25 GMT-0500 (EST)
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done:
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done:
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done:
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: Initiated command adds
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: Initiated command removals
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: { message: 'Subscribed to 5038e6811ca15100191cf7de!' }
Thu Mar 4 10:36:25 2021 daemon.notice procd: /etc/rc.d/S95done: { message: 'Subscribed to 5038e6811ca15100191cf7de!' }
Thu Mar 4 10:37:19 2021 daemon.notice procd: /etc/rc.d/S95done: { trigger: 'AdBlock', id: '503962d2b77e2b0019cf137a', params: 'off' }
Thu Mar 4 10:37:19 2021 daemon.notice procd: /etc/rc.d/S95done: Running trigger: AdBlock Command: /scripts/adblock.sh off
Thu Mar 4 10:37:20 2021 daemon.notice procd: /etc/rc.d/S95done: Reported: Command Ran -
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ I can't get it to work. I created an initscript in /etc/init.d and and enabled it but can't seem to get it to work.
#!/bin/sh /etc/rc.common
START=35
boot() {
starttriggercmd
}Also tried
#!/bin/sh /etc/rc.commonSTART=35
start_service() {
starttriggercmd
}strarttriggercmd is a command I wrote to start the daemon.js and if I run it from the prompt it works. It basically just runs this:
node /gitrepo/TRIGGERcmd-Agent/src/daemon.js --run /root/.TRIGGERcmdData -
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
@Russ Having an installing and getting the daemon running.
ran .src/installdaemon.sh and got installdaemon.sh not found even though I can see that it is there:
I then opened installdaemon.sh to run the code manually. I verified that node.js is installed.
So skipped that and then I ran the bottom section of code in installdaemon.sh and got the following errors:
systemctl and systemmd are not installed for OpenWRT.
TIA.
Scott
-
RE: Turn your VPN on/off
For OpenWRT you can start the VPN interface with:
ifup VPNInterfaceNameAnd Stop it with:
ifdown VPNInterfaceNameMore info:
https://openwrt.org/docs/guide-user/base-system/basic-networking#network_management -
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
Also I can't find installdaemon.sh to get it to run in background on boot.
-
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
How do I create commands from CLI? The instructions say to use GUI Command Editor via the tray icon, but I'm running headless mode. Thanks!
EDIT: Found it. Need to edit /root/.TRIGGERcmdData/commands.json
Here are examples: https://github.com/FYDesktop/triggercmd-commands/blob/master/commands.json -
RE: How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
I think that worked, thanks!
-
How do you install TRIGGERcmd on Raspberry pi with OpenWRT?
I have a Raspberry Pi4 running OpenWRT.
I followed the instructions for installing TRIGGERcmd on OpenWRT (NAS or Router), but when running node ./src/agent.js --console i get the following error:npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for node-windows@0.1.14: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"arm64"})
npm ERR! notsup Valid OS: win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: arm64I don't think the file in those directions supports arm64 Linux (Raspberry Pi). https://github.com/rvmey/TRIGGERcmd-Agent.git
I cannot install the .deb file (triggercmdagent_1.0.1_all.deb) recommended to use for Raspberry pi install instructions because I don't have dpkg only opkg available.
Is there a .ipk file for Raspberry that I can use to install? Or a different version on Git that supports arm64?