• Post Reply Bookmark Topic Watch Topic
  • New Topic

Shell Script from JAVA program

 
Khirod Patra
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my application it required to stop and start the linux process from my Java program i.e.

Process pads_process0=Runtime.getRuntime().exec("padsctl restart");

but it throws error like

kill 31281: Operation not permitted
[!] FATAL: Must be root!

Then I tried that command with sudo, but it does not stop and restart it again. it just create another two hung process for stop and start.

Please help me out

Let me know for any further information

Regards
Khirod patra


 
Eddy Pelaic
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I did an application who launch perl scripts with root privileges from Java, but I launch the script with a C program with SUID root do call a execl(...), because it's forbidden to run scripts with SUID root. they must be wrapped in a C program.

C program


Perl script


Be extra careful if you pass parameters to the C program ! Do not pass to execl() dynamically the program name you want to call.

Hope it can help you.

@+
Edo...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!