LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2010, 10:37 AM   #1
khirodpatra
LQ Newbie
 
Registered: Nov 2009
Distribution: debian,ubuntu,redhat
Posts: 10

Rep: Reputation: 0
Restart PADS from Java Program


Hi,

I am facing problems to restart PADS(Passive asset detection system) from java program.I used the root as a user. So from the command prompt I can start PADS with out sudo ,but when I try to start PADS from the my java program i.e.

Process proc=Runtime.getRuntime().exec("pads restart");

It throws the error in log that FATAL error ! you not root
and permission denied.

Then I tried the same with sudo

Process proc=Runtime.getRuntime().exec("sudo pads restart";

Here it create another two process extra
1 for stop the pads
2) for start the pads

It does not kill the previous process of PADS .and both the process get hung.

Please help me how I can solve this , that will work same in both from terminal and the java program


Regards
Khirod Patra
 
Old 07-15-2010, 02:08 AM   #2
jlanawalt
LQ Newbie
 
Registered: Feb 2005
Distribution: Debian
Posts: 8

Rep: Reputation: 0
Breaking it down

Take your problem and break it down into pieces:
  • Call a program from Java
  • Call a program with arguments from Java
  • Call a suexec root program from Java
  • Call a program via sudo from Java
  • Verify your restart command from the command line, then implement that in Java

Doing this can help you determine if it's a PADS issue, or inexperience with the Runtime.getRuntime().exec(...) method--which looks like a mix of the system and exec C calls--, or with your restart command. Divide and conquer, write small test cases, keep it simple.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restart Program when crashed prudens Linux - Newbie 1 02-05-2010 01:58 PM
USB game pads under linux Thetargos Linux - Hardware 14 05-16-2005 02:41 AM
Way to automatically restart a program? AlexV Linux - General 1 04-13-2005 06:23 PM
Stop java program(threaded program..should end cleanly) rmanocha Programming 4 11-09-2004 10:36 AM
Restart a program sibtay Programming 4 09-28-2004 11:46 AM


All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration