Reputation: 472
I am looking for a portable way to update the configuration files of a Linux service e.g., ssh, and then restarting that service from a Java program. For example, the Java program fetches some user names from a remote database, updates the AllowUsers directive of the /etc/ssh/sshd_config file and then restarts the ssh service.
Especially if you can point me to an API that can manage the text based conf files from a Java program, that will be great. Thanks.
Upvotes: 0
Views: 321
Reputation: 86774
Here's a good place to start: Comparison of Open Source Configuration Management Systems
Most configuration management systems are written in scripting languages (Perl, Python, etc), but the list contains two libraries written in Java.
Upvotes: 1
Reputation: 28168
You can process files with standard classes like BufferedReader
and StringTokenizer
for splitting.
To execute commands, Runtime
or ProcessBuilder
classes.
Upvotes: 0