List currently open netbeans projects from command line
I'm working with multiple (relatively) small projects, mostly one project per client. I'd like to get an estimate o开发者_JS百科f percent-of-day-spent-on-client by noting when a project is opened and closed.
How can I get a list of netbeans projects from the command line?
Installing an extra netbeans module or checking a log also acceptable, but my google-fu has failed so far.
It is technically possible to do this; not sure how far you would want to take this though it may just be easier to manually note the the time spent on each client but putting that to one side here are the tools that you need to make use of, assuming that you are running Linux let me know what OS you are running.
lsof - lists files currently open along with the corresponding process id.
pgrep - given a process name you can easily retrieve the process ID for Netbeans and pass it in as a param to lsof.
Your bash script would poll for the current Netbeans process id and then check to see which files were open then it would need check the time and add it to some sort of of persistent storage.
You would need to decide how aggressive your script was so as to balance the accuracy versus using your machines resources of course.
Let me know what OS you are using and I can flesh out that answer a bit further.
精彩评论