Help running commands through webhook (First time user) #558
-
So first of all, please bear with me, I'm fairly new to linux in general! What I'm trying to achieve is this: # Running the first two right now to test if it's running in the right place and all
whoami # sammy
pwd # /home/sammy/path
# The commands that actually matter
git pull git@github.com:SammyWhamy/repo.git # command output: git@github.com: Permission denied (publickey).
yarn install # yarn: not found
tsc # tsc: not found
pm2 restart 0 # pm2: not found I believe I can solve the Git issue myself, maybe not with SSH but I can always just use https with credentials, the main issue is the My config looks like this: [
{
"id": "name-here",
"execute-command": "/home/sammy/path/script.sh",
"command-working-directory": "/home/sammy/path",
}
] I've been messing around with this for 2 days but I just can't figure out what is going wrong. @reboot webhook -hooks /home/sammy/hooks.json -verbose >> /home/sammy/logs/cron_webhook.log 2>&1 I've already tried other stuff such as |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Update, I tried using the absolute paths to the executables: #!/bin/sh
git pull # This works!
# These next 3 all return:
# /usr/bin/env: ‘node’: No such file or directory
/home/sammy/.nvm/versions/node/v16.7.0/bin/yarn install
/home/sammy/.nvm/versions/node/v16.7.0/bin/tsc
/home/sammy/.nvm/versions/node/v16.7.0/bin/pm2 restart 0 Now I think it's good im getting a step further but I assume yarn is trying to call |
Beta Was this translation helpful? Give feedback.
-
Update 2, I fixed my issue! What I ended up having to do was this: export PATH=$PATH:/home/sammy/.nvm/versions/node/v16.7.0/bin # I also added the rest of my regular PATH but I think this is all that was needed
# Rest of script Again, most likely this was a pretty stupid question but I'm glad I resolved it! |
Beta Was this translation helpful? Give feedback.
Update 2, I fixed my issue!
What I ended up having to do was this:
Again, most likely this was a pretty stupid question but I'm glad I resolved it!