changes in shell script does not refresh in Linux - linux

I have a shell script, called startmq.sh, to run activeMQ. However I changed the script, it did not refresh the changes at all.
Even I only wrote echo "Hello World", it did not refresh and was trying to run activeMQ with wrong parameters.
Then, I copy startmq.sh to abc.sh and tried to run abc.sh. It showed Hello World.
Plus, I need to use that standard name startmq.sh.
Thanks.

can it be, that you have this script multiple on the server?
under bash do the following whereis shows you the locations of the script(s) and which shows you witch script ist starting ...
bash:# whereis startmq.sh
bash:# which startmq.sh

There must be another copy of startmq.sh somewhere accessible due to its path being amongst the PATH enviroment variable.

Related

Why am I not able to receive output when running python code in VSCode?

I have tried to print simple messages like "Hello World!" but have always been met with: [Running] python -u "/Users/user/HelloWorld!!/app.py"
/bin/sh: python: command not found
[Done] exited with code=127 in 0.176 seconds
enter image description here
Is there any way to get passed this error?
Check environment variable PATH
Every time you as a user run a command on your console, the machine looks for its location, or address, inside a list of predefined directories that are stored inside the environment variable PATH.
Such design helps to properly run the program or command without having to specify the absolute path on the terminal.
The environment variable PATH can be modified temporarily for the current terminal session, or permanently.
For windows/mac/linux
AND
Go to the VS Code preferences, and under interpreter, you'll find Interpreter Path, so set that to the path of your python installation, restart VS Code, and you should be good.

Is it possible to run a command from Cygwin, into a Git Bash terminal, with arguments?

I haven't been able to find a similar question, but I can't imagine this is an issue that comes up too much.
At my workplace I've decided to switch over to a full Linux experience by using Cygwin, over what I was previously using, Git Bash.
The only slight drawback is that we have a script written in Ruby that deploys changes to our site. I can run this from my Git Bash terminal no problem, but not Cygwin as there doesn't seem to be a Ruby installation on here. I've learned about sending standard output to other terminal windows, but I've only been successful when both terminals have been the same shell.
What I'd like to do is the following:
1. Type a command into Cygwin that opens a Git Bash terminal and automatically runs ./deploy.sh on that Git Bash terminal upon opening.
2. If possible, also pass in an argument in the same command, that the script expects upon running. (In this case it's whether we want to deploy to our staging or production server).
Is this possible? So far I can get what looks to be a Git Bash terminal to open and prompt me for the server, but when I enter it, it does not work. I get an error with regards to a command within the script not being found. Thing is, running this same ./deploy.sh script in a Git Bash terminal that I open myself works perfectly as it always has. The Git Bash terminal that is being opened by Cygwin does not appear to have all of the capabilities of a Git Bash terminal I open 'the normal way'.
The command I am running so far from Cygwin is as follows:
/cygdrive/c/'Program Files'/Git/git-bash.exe "./deploy.sh"
I understand there is probably a way of getting this to work by installing Ruby via Cygwin but I'd like to mess around with my work environment as little as possible in case I somehow affect my ability to deploy my work... and besides, Git Bash definitely runs this script without an issue so I can't see why I would need a duplicate installation.
Many thanks!

Shell script can't find other files when launched on login (Debian Linux)

So I have a script that is launched on login via rc.local. The script calls a few other scripts to be launched and ran. However the console says that the file and/or directories could not be found. When I run the script manually after the login it works just fine. I have even tried to add a small delay so that I know that the system logged in. Any idea why this is and how to fix it?
Sorry if my answer is a bit vague but from what I understand is that the scripts require to be run via admin privileges. Let me elaborate, when the system starts it runs a set of specific scripts and this differs from distro to distro. Therefore, I'd check ~/.bashrc /etc/profile.dand most importantly ~/.bash_login. See what you can do there. Personally I added it here ~/.config/autostart worked fine. Don't forget to create a .desktop file.
Hope this helps

IZPack Setting Linux Environment Variables

I am sure this has to be out there somewhere, but after about a day of searching I am stuck. I am trying to use IZPack to do an installation on Linux and trying to call a shell script that sets some environment variables. However I don't know how to "source" the script instead of just running it. Running the script using:
<executable type="bin" stage="postinstall" targetfile="$INSTALL_PATH/myscript.sh" os="unix"/>
This only executes the script, it does not source it. So all exports of ENV variables are lost once the script completes.
How can I source my scripts from IZPack instead of just running them?
IMHO you simply cannot influence the shell environment your Java process of your IzPack installer is running in from that process itself.
Torsten is right. This is not an issue of IzPack, Java or anything else, this is just the way operating system process work with respect to environment variables ;-)

Having trouble with post-commit hook

I am following this tutorial that is like the hello world for post-commit
I am using Ubuntu 10.04. I installed svnnotify and ran $ which svnnotify which output:
/usr/bin/svnnotify
so I changed the path in the turorial from /usr/local/bin/svnnotify to /usr/bin/svnnotify
I also tried changing the line: #!/bin/sh to #!/bin/bash since bash is the login shell in ubuntu 10.04.
I tried to run it the way the tutorial originally had it, with my changes, and combinations of the two.
Every time the commit is successful but I get
Warning: post-commit hook failed (exit code 1) with no output.
The original way had output not found
I am very new to linux and shell scripting and have exhausted everything I can think of. What am I doing wrong?
Get the script working and tested before trying to run as a commit hook. I expect that your problem is something to do with the script, maybe not being marked as executable, environment wrong, etc.. i.e. if you can't get it to run successfully from the command line, this is more of a unix/shell question and doesn't really have anything to do with SVN (yet).
I'm not sure whether this applies in the Linux world, but in the Windows versions of SVN I've used, the code which runs the hook scripts only captures STDERR. If your hook script is only writing messages to STDOUT, that would likely explain the "No Output" warning.

Resources