Hi I have been doing some manual tasks which consume some of my time and I want to automate it the tasks are:
Connecting to remote windows server using mstsc command and restarting some services.
Connecting to remote windows server and modifying the files, checking the modifications and then again reverting the changes when the changes are tested.
I want to know whether I can achieve a one click solution for this scenario by writing some code in java and reducing the manual time.
Or is there any other solution for the same which can be generic and could be implemented on other servers too.
The steps for the solution to cover would be:
Connect to remote machine using username and password.
Restarting the services from the code or just executing a batch file for the same which could be lying in some folder on the same machine.
Modifying some files on the remote machine.
Related
Within my organization, I'm tasked with doing some Spark development and I'm trying to use Scala, but much of the other code is Java. I'm managing dependencies with Maven. My code ultimately will work and run on an edge node of a Hadoop cluster (Cloudera).
This edge node is only accessible via SSH through a jumpserver, and I'm struggling to find an efficient workflow. The others on this team have been debugging via including print statements, building .jars locally, copying them to the edge node via WinSCP, and then running them via command line on a Putty session (SSHed into jumpserver, then using SSH command in that session to connect to edge node).
me -> jumpserver -> edge node
I am wondering what a solution would be such that a jar can quickly be built and put on this server and have it run in that environment while being connected for remote debugging.
Eclipse and IntelliJ both have facilities for remote debugging, but can this be made to work through a jumpserver, and when we can only do it through SSH?
Would it work to somehow map a directory on the edge node to my local filesystem and have the IDE put the .jar there and debug it there?
--- Keeping in mind that the .jar would really need to be in the edge node's server context/environment (for Spark/Hadoop hdfs), so this wouldn't work if the .jar would try to use my local Windows environment
What solutions are there to this? Thanks!
Optional other info:
We have Jenkins running to where code automatically built each time we check in code changes, and we have a build/deployment management service in-house that can be configured to actually output a .jar and optionally deploy it to a server. This, however, is much too slow to be practical for running code to check changes and doesn't solve the debugging issue.
Can you check jsch java library by which you can connect to unix server and pass your required command. In your case you need to connect to jumphost and then pass commands like your edge node host and required commands.
My friend and me want to explore an Open Source ERP System. We have installed it on a server and we access it by an IP address over Firefox. We're also accessing it over the tools putty (for doing changes like restarting tomcat) , Filezilla (for import export of data), pgAdmin (for accessing the psql db). Now we want to establish a java Eclipse developer environment on both our windows pcs working simultaneously. I need to access, change and commit to the source placed on the server. Every time I commit, I need to deploy the source code with putty.
1) Is there a better way of this way of remote programming? If yes, could you tell me a better way?
2) If not, how can I set this kind of environment in Eclipse (Create an existing project?)
You need configure Jenkins Which will deploy the latest code into remote server
You can use Ansible to automate your deploy
I have a Java app running on a remote server (debian linux). The app logs runtime informations to files.
Once in a while, the support needs to analyze the logs using a client tool (not running on the server, but on the support's desktop). The tool then needs remote access to
old log files on the server
the current log file (growing in real time)
I'm searching a good (=standard, flexible, secure, well debugged etc) way to stream these past and present log messages to my client tool.
How would go about doing this?
Does a library exist, which provides this service?
Can syslog be adapted to do this?
Edit: For privacy reasons, the log files should be stored on the remote server only and not generally sent to a central logging service.
Why not use Log4j's capability as a publisher of log files to a remote server via TCP? Log4j is a standard Java logging tool (well-known/well-documented) and setting up the remote connectivity is pretty straightforward.
I've used this in the past to transmit across networks and collate log files from multiple machines in one common searchable directory structure (very useful in grid environments when you don't know where your processes could be running)
See this page for more details.
The simplest approach is likely to setup samba on the Linux box so you can access the logs remotely as they are updated without having to copy them.
You could use rsync. This allows you to securely copy changes to files between machines. i.e. an appending file would only copy the changes since the last rsync. Note: you have to run it repeatedly to keep seeing updates.
If the tools could be modified to support SSH e.g. via VFS, then you could access the remote files as if they were local.
Is it possible to have ANT restart your java application on a remote server from a build script? If so any pointers to where that might be defined?
I'm using ant now to push the new code over to the remote server but I still have to login to actually restart the app
Using the <sshexec> task you can do pretty much anything on a remote machine (assuming it's got an sshd running). If you don't want to worry about authenticating the ssh session every time, you can set up RSA keys.
<sshexec host="remotehost" username="remoteuser" command="/restart/application/command"/>
Heed the statement at the beginning of the above link:
This task depends on external libraries
You'll need to grab JCraft's JSch jar and put it on Ant's classpath.
i have 2 csv files on my windows machine that i want to transfer to a unix server every hour (because the 2 files are updated every 30min).
so i search on the web and i found this possibility: to ftp the files from windows to unix using a batch and task scheduler.
i want to know if it's possible to do it from the unix server with a cron job or with java timer and not from the windows machine and if if there's other easier solutions.
thanks for your help
The main problem you would have is in allowing the Unix machine to access a Windows file.
You didn't specify what kind of networking configuration you use and what version of Windows it is, as some later versions provide facilities for file sharing across platforms.
In the worst case, you could set up an FTP (or SFTP) server on your windows machine, share a specific directory in which you will put the file, and then write a script on the UNIX that will download the file from the windows machine. A variation on this is to install a web server on the windows machine, and have the script on the unix make an HTTP request for the file.
You could install a webserver like http://www.aprelium.com/abyssws/
It seems to be free and should be not that hard to set up. Afterwards put your files in the htdocs-folder and configure your Vista-firewall to let requests on port 80 pass.
Then you can access your files via
http://IPofYourWindowsComputer/yourfile.zip
If you want to access your windows machine from outside your local network you'd have to setup your router to forward port 80 to your windows machine. Otherwise the machine from outside will be blocked by the router.
PS: Samba (SMB) just works within the same LAN. If you are you could create a shared folder and put the files in there and access them via smbclient or mount.
PPS: Maybe your question is better placed # http://serverfault.com