Reputation: 6476
I have an application running on a server which is doing stuff and writing everything it does to a log file.
I also have secondary application which is kind of like a monitoring panel also running on the server but is a different process. What I would like to do is the following:
I would like my monitoring file to be able to copy the log file which currently has a lock on it from the other application and then email it to me. I have tried using scp to connect to the server and copy it manually to my computer(and it did work), however I would like to be able to do that through my java monitoring application. And I have no idea where to start.
Upvotes: 1
Views: 116
Reputation: 8348
I have tried using scp to connect to the server and copy it manually to my computer(and it did work)
The JSch library has a ScpFrom module that you can use to scp
copy the data from the server to your computer or application. This can be done by one of the following:
classpath
(more programmatic control - preferred approach) String[] args = {user@remotehost:file1" "localfile"}; SCPFrom.main(args);
Upvotes: 1