• Post Reply Bookmark Topic Watch Topic
  • New Topic

Designing Around UNIX File /etc/services  RSS feed

 
Manuel Farias Hernandez
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!

I am writing an application that needs to add, modify, and remove entries (services) to the file /etc/services. Furthermore, I thought that my application might not necessary be the only application needing to access the /etc/services file. In addition, there is another file, the /etc/inet/services file. And, maybe, my application needs some day write to a database.

So, this is what I have tought:
MyApplication ---> Services ---> EtcServices ---> /etc/services

Now, is that a good approach, or are there other ways to go? What do you say?

Best regards,
Manuel Farias Hernandez
 
Manuel Farias Hernandez
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I have started to write a class that will handle access to the UNIX file /etc/services. The class, will be named EtcServices. The class will, for example, have the possibility to search for a specific service, for example, ssh, and return an object holding information about that service.

Any thoughts? Suggestions?

Best regards,
Manuel Farias Hernandez
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I'd recommend writing to /etc/services in Java. Generally I do that as part of a package installer's scripts.

For reading, you can easily dissect lines into service-name, port, protocol and (0 or more) aliases using the java Regular Expression classes.

/etc/services isn't definitive, however. For example, we never bother to add 8080/tcp even though we have a Tomcat server on the box.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!