how to run resque startup script from bash with full path - linux

I am trying to run the following command:
/A/B/C/D/E/RAILS_ENV=staging rake deploy:resque
And the get the following error
-bash: /A/B/C/D/E/RAILS_ENV=staging: No such file or directory
But when i run the command directly from the folder it works nicely.
I don't quite understand how it is supposed to work
Thanks.

cd /A/B/C/D/E && RAILS_ENV=staging; rake deploy:resque

Related

pipenv shell working but an error is displayed

If I run the command:
pipenv shell
in my Mac shell, everything works fine and a new virtual environment is created and activated:
.../django_celery_rabbit_flower$ pipenv shell
Launching subshell in virtual environment...
bash: parse_git_branch: command not found
.../django_celery_rabbit_flower$ . /.../django_celery_rabbit_flower-rEt8HW1V/bin/activate
bash: parse_git_branch: command not found
(django_celery_rabbit_flower) .../django_celery_rabbit_flower$
but a bash error is displayed:
bash: parse_git_branch: command not found
I do not understand where it come from. Any idea?
UPDATE
Jen answer trigger a little thought. I have checked my ./bash_profile and I can see the line:
export PS1="\[\033[36m\]\u\[\033[m\]#\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$(parse_git_branch)\$ "
This shows the git branch on the bash prompt. So I believe vscode uses this settings. The folder I am working on is not a git folder. Can I write an if statement to avoid the error being displayed when running the python virtual environment?
Instead make sure that the command does actually exists before running it.
PS1="...."'$(if hash parse_git_branch >/dev/null 2>&1; then parse_git_branch; fi)'"..."

Docker nodejs cannot open file

I have a docker container with nodejs in it. (node:14.11-alpine3.12)
There is cron running, that executes .sh file with the command:
node /home/parsecsv.js;
Whenever cron executes this command, I get an error
'rror: Cannot find module '/home/parsecsv.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
...
I am absolutely sure this file exists, even more, when I go to the container shell and run this command (node /home/parsecsv.js) from the command line it works just fine. What can I do about this?
Check permission of the file, you may debug by giving full permission to file.
add this to your docker file and see if still the issue persists.
RUN chmod 777 /home/parsecsv.js
So, what helped me is to copy js file to /root directory instead of /home. And then change path in work.sh to this: node parsecsv.js It seems like when node is running from sh script it cannot read absolute path or something. That's confusing, but now it is working.

cannot execute binary file exec format error windows bash

Am trying to deploy my node express app to heroku from my windows 10 os and am using the git bash terminal, but anytime i try to run the heroku command it returns this error
'/c/Users/user/AppData/Roaming/npm/node_modules/heroku-cli/bin/run:
line 19: /c/Program Files/nodejs/node: cannot execute binary file:
Exec format error'
Please does anyone know how i could solve this challenge?
PS: i ran the command as administrator on git bash
From heroku-cli GitHub repository I can see the following 19th line of the run file:
node "$DIR/run.js" "$#"
Looks like it tries to run run.js file but fails because can't recognise node as an executable binary file.
It's possible that you have a NodeJS version with wrong architecture or installation was not successful. Anyway seems like node is not installed correctly.
So I would uninstall it properly and install it again regarding architecture of the OS

Executing Newman REST API tests using Jenkins on Linux

I found this answer Integrate Postman test scripts with Jenkins build server (and possibly there are other ones that could answer my question but I just suck at finding them) but I am still running into issues. I am trying to execute the following with newman v3 using jenkins as a way to automate our REST API Testing.
My Execute Shell script looks like this under the Build steps in the jenkins job
#!/bin/bash
pwd
cd ${PROJECT_NAME}/${GIT_SUBFOLDER}
pwd
ls
newman run ${COLLECTION_NAME} -e ${ENVIRONMENT_NAME} -r html,cli,json,junit --insecure
Ignore the pwds and ls as I originally thought I wasn't in the right directory for my collection and environment exports.
The error I keep getting back in jenkins is:
/tmp/hudson1153303836033593524.sh: line 6: newman: command not found
Any help would be greatly appreciated!
Got your problem, Seems that you are trying to execute your project as shell script in jenkins and jenkins cant get newmanHere is the solution, might solve your problemIn your script export path where npm modules get installedLocate node_modules for your system generally its at /usr/local/lib/node_modulesNow add line in your script which will export PATH:
#!/bin/bash
export PATH="<Your node_module Path>:$PATH"
pwd
cd ${PROJECT_NAME}/${GIT_SUBFOLDER}
pwd
ls
newman run ${COLLECTION_NAME} -e ${ENVIRONMENT_NAME} -r html,cli,json,junit --insecure

Starting Ant build from bash script: build.xml does not exist

I am creating a bash script in Linux (ubuntu) that starts an ant build from a build.xml file, located in another directory. My folder structure looks like this:
myBashScript.sh
/project56
/http
build.xml
When I try to call this build file from myBashScript.sh I get the following error:
"Buildfile project56/http/buildfile.xml does not exist!"
I tried the following:
sudo ant -buildfile project56/http/build.xml
sudo ant -v project56/http/build.xml
sudo ant -v fullPathStartingFromHome/build.xml
But I keep getting this error. The funny thing is, when I try to invoke ant (using the first option listed above) from the terminal in the same location that myBashScript.sh is in, the build starts fine.
Can someone help me with this?
Thanks in advance,
Robert
Fixed it, turns out another cd to project56 buried somewhere in my script was screwing things up.

Resources