I have a service in linux called appSevice
When I start and stop with these commands, it works:
sudo systemctl start appSevice.service;
sudo systemctl stop appSevice.service;
But when I try to execute these from JAVA code, for example:
Runtime.getRuntime().exec(new String[]{"systemctl", "stop", "appService.service"});
...it doesn't work and I get this error:
> Failed to stop appService.service: Interactive authentication required
Here's my service :
[Service]
Type=simple
ExecStart=/opt/soft/v1/launchAppService.ksh start
User=Jms-User
Restart=on-abort
Is there a way to avoid this error and run the service without providing a password?