I need to run a db script to take oracle database backup in a remote server using Jenkins in Windows environment. Is it possible? I created a Free style project in Jenkins and installed SQLPlus script runner plugin. But it didn't work. Can anyone please advise me how to do this?
If you have a simple shell or python script to run from jenkins then you can do it like this :
Configure jenkins job to run as shell script
and write something like
#!/bin/sh
sh <location_of_shell_script_for_backup>
You can change sh as per your requirement.
Related
I have a situation where in I need to copy set of files to a windows server through Jenkins. I see a lot of Jenkins plugins that will do this kind of job through ssh but not in my case. Jenkins is also hosted in a windows server and end server is also a windows, so I believe ssh is not an option. Any plugin available in the market to get the job done or writing our requirements in powershell/MSDos script is the only option?
Thanks in advance!
just execute a bat command with the following
copy C:\localfile.bak \\remotemachine\c$\Path\remotefile.bak
in the Using the Execute Windows batch command option in the build Step
How to run bat file in jenkins
I am in the process of writing a declarative jenkinsfile to build a pipeline project. Some of the steps within a few of the stages will require some remote commands to be run. The remote ssh sites have been configured in the main jenkins configuration.
How can I declare these steps within my jenkinsfile? I know I can run shell commands locally using sh but it's the remote servers that i need to know about?
You need to install ssh-agent plugin then you will be able to execute remote commands using ssh. Check this for examples
Is it possible to call Jenkins CLI commands within a pipeline?
Upon migrating jobs to new Jenkins instances I would like to enable users to migrate their own jobs from an old Instance.
Yes, you can write pretty much any shell code you want, including calling the CLI jar from a shell instruction.
sh "java -jar /path/to/jenkins-cli.jar your-usual-command"
I would want to execute the shell script using Jenkins.
For example, I have a shell script MakeTest.sh which is on the server "test1.test2.net" location "/home/rt", how would I execute it? My Jenkins and script to be executed are in different servers.
Thanks!
Using git, you can download the file into the workspace of your job.
After you just have to launch the script ./MakeTest.sh
How can I connect Jenkins to Microsoft SQL Server?
I would like to run a script using Jenkins to update some tables in the database.
It really depends on what you really want to do. If you just want to run a script which connects to the DB and executes the queries using the command line client, you can use the existing "execute shell / batch" build step, or some of the plugins:
ssh plugin - remotely execute a script
x-shell plugin - makes it easier to integrate scripts for cross-platform envs
You could also try and build your own starting from the basics, Jenkins library plugins