any linux guru ?
i have following problem:
(if you have experience with linux, ant and jenkins read bellow)
as part of automatic tests i have to run installer/uninstaller of (nonamed) sw.
the installer is bash script and due someones 'good' idea it must to run under root
BUT
we run all testing process from jenkins as an ant job and installation is done on jenkins slaves via ssh. jenkins currently logins as root but i dont want it to leave it this way.
so the correct way should be log as dedicated user (say jenkins) and do
sudo bash -c 'nameofthebashinstaller -andparamsforsilentinstall'
but im constantly getting
sudo: bash -c 'nameofthebashinstaller -andparamsforsilentinstall' :command not found
note thats in case this is <exec>uted from ant build.xml
strangely enough, typing exactly same command under same user (not root) directly will pass.
can anyone help (please avoid blind shots - i spend last 2 hours by googling and throwing away useless solution).
thanks in advance.
(if you have experience with linux, ant and jenkins read bellow)
as part of automatic tests i have to run installer/uninstaller of (nonamed) sw.
the installer is bash script and due someones 'good' idea it must to run under root
BUT
we run all testing process from jenkins as an ant job and installation is done on jenkins slaves via ssh. jenkins currently logins as root but i dont want it to leave it this way.
so the correct way should be log as dedicated user (say jenkins) and do
sudo bash -c 'nameofthebashinstaller -andparamsforsilentinstall'
but im constantly getting
sudo: bash -c 'nameofthebashinstaller -andparamsforsilentinstall' :command not found
note thats in case this is <exec>uted from ant build.xml
strangely enough, typing exactly same command under same user (not root) directly will pass.
can anyone help (please avoid blind shots - i spend last 2 hours by googling and throwing away useless solution).
thanks in advance.
Post edited by Fikee on
Comments
Assuming that's ok, you may need to provide a full path to bash, depending on how your OS is configured.
good point, will try. thanks
What is used to find executables, might not be what you think it is. Especially when running a script from a build framework that may change/set environment variables before executing parts of the process. Btw is that bash installer marked executable for the user that runs it?
As others have mentioned, check the paths relevant for the bash script under sudo.
However, I wonder why you do it that way? It would be more "safe" to do
Because the normal user would never get into the bash commands and such.
This is a developer, and these tasks are for development - not "normal users". On Windows, a developer would have to do similar kind of things, edit build scripts, write command line tools etc. to control automated building and testing. Same is true for Mac OSX. The Spectranet build is all done on my Mac, but it's all command line. Automation of builds and testing is far easier to do by writing scripts than clicking buttons.
For normal users doing desktop things on any vaguely recent Linux distro, you never need to open a terminal window. Things have moved on since 1999...
In any case Linux *is* the top OS, on mobile phones. Android currently has the largest smartphone share. Android is Linux based. Microsoft is relegated to a mere "also ran" in the smart phone (really, pocket computer) world.