• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1047
  • Last Modified:

Executing a shutdown of JBoss as a linux normal user that has sudo access.

Hi Experts,

I have a user student that I have granted sudo access on Linux so that he can execute the following command /jboss-4.0.4.GA/bin/shutdown.sh to shutdown JBoss. I get the following error appearing when i try with the student user:
student@server1 bin]$ sudo ./shutdown.sh
/jboss-4.0.4.GA/bin/shutdown.sh: line 78: exec: java: not found
Seems it cant find the Java VM for that user...
Has anyone ever tried to stop jboss  as a different user.

Regards
The Duke
0
LinuxDuke
Asked:
LinuxDuke
1 Solution
 
gaston_acevedoCommented:
Hi,
that problem indicates no java for your user.
in the linux box type set |grep JAVA_HOME

or

java --version

tell me wath you get
0
 
segurahCommented:
Find your java install folder, then do

export JAVA_HOME=/opt/jdk1.5.0_16 (adjust to your java install path)
export PATH=$PATH:$JAVA_HOME/bin

Note: try to find your java path using ' find / -type f -name java'
0
 
LinuxDukeAuthor Commented:
Hi Experts,

I logged as the user student and exported JAVA_HOME and PATH and this is the out put I get but this disappears when I log off where should I place this on a file where it will be permanent for this user.
As I still get the same error when I execute the shutdown.sh:

[student@server1~]$ set |grep JAVA_HOME
JAVA_HOME=/opt/jdk1.6.0_02
[student@server1 ~]$

[student@server1 bin]$ sudo ./shutdown.sh -S
/jboss-4.0.4.GA/bin/shutdown.sh: line 78: exec: java: not found
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
segurahCommented:
edit .profile file in user home dir.
0
 
GnsCommented:
You also forgot to amend the path, so the shell cannot find the java executable. Please try all the steps above, and see what happens then.

Easiest might be to put all this in a script and "sudo /path/to/script" from the user, just for ease of use, unless you want the environment change ... If you do set the users environment, remember to preseve that in the sudo call, via the -E flag ... would make the call look like "sudo -E /path/to/script". Might actually be all that is wrong here, that the user didn't try preserve the environment:/

Cheers
-- Glenn
0
 
LinuxDukeAuthor Commented:
I decided to give the user super user access via sudo to resolve this has he need to execute that shutdown.sh commanda.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now