Executing Talend jobs with Rundeck - talend

Hello dear community !
I am trying to use Rundeck to monitor and administrate my talend Jobs. I don't really get how to make this work...
I bluid the job in Talend which created a test_run.bat, a test_0.1.jar and 3 folders ( src, project_name, items).
I created a project and a Job in Rundeck, and in the job i inserted the directory to the test_run.bat file in the workflow section.
Of course it failed when I executed the job, I'm stuck...
I'd really appreciate if anyone who already worked with rundeck to execute Talend jobs could help me out !

It is possible. However there are more questions to ask before an answer can be given.
What is the full path to the bat or sh file of the job, on the server where it will be run?
Will the job be run on Windows, Linux, or another platform?
What is the script (rundeck) used to execute the job?
Is the same version of java installed there ?
What error did you get ?
Obvious things to check:
Path and permissions

Related

How to control window AD with rundeck

I'm looking for the best solution for automating Windows server 2012r2 via Rundeck. I'm extremely familiar with Rundeck but use it for linux vms. I've searched online for this topic but havent found anything that seems reliable. Ideally, I want to start a Runeck Job that can add users in Active Directory but not sure how to approach it. I've tried using winrm but have gotten mixed results. Ironically, it will run basic powershell commands but it errors when trying to do anything with AD. Ive even tried creating a powershell script on the AD server and have Rundeck simply execute the powershell script to no avail. Hopefully someone has had success in controlling windows nodes with Rundeck. Below is the error i receive when trying to run a powershell script.
Execution failed: 27 in project windows: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [Windows_AD_Server: NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, Node failures: {Windows_AD_Server=[NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, status: failed]
Firstly, PowerShell already offers a built-in way to execute jobs, with no 3rd party addons.
About Jobs
Provides information about how PowerShell background jobs run a command or expression in the background without interacting with the current session.
About Remote Jobs
Describes how to run background jobs on remote computers.
PowerShell Jobs Week: Remote Jobs
I've never heard of / used Rundeck as Paul points out as well, so this just be the Rundeck has particulars that need to be in play first. Yet, looking at the docs, and a quick youtube video on the topic, there are several things that must be in place for what you say here...
I've tried using winrm but have gotten mixed results.
… to work.
Video - Running commands remotely using the console with WinRM/WinRS
If Rundeck is similar to SCCM or Scheduled Task, then the same approach applies.
Write Your PowerShell script. have Rundeck/ScheduedTask call powershell.exe to run the script
How to execute a PowerShell script automatically using Windows task scheduler?
Also, this could very well be seen as a duplicate of this stackoverflow discussion and answer.
rundeck unable to execute powershell script with import-module
I am setting up somethin similar and have the same problem. The AD operation executes successfully, but returns exit code 1 and throw the error you mentioned. I am in the process of debugging the plugin, but it seems there is a bug within response handling.
Please check if the ad operation works although the error is thrown and please post the script block you are using to control the AD.
Edit: in meantime I was able to narrow down the issue and opened an issue with the project: github
I provisionally fixed the issue with adding the following line in winrm-session.py after line 89:
new_msg = msg
The line before is:
" error message: %s" % (e))
The line after is:
else:
If this does not solve your issue, please post your script block.
Best Tobias

How to programmatically (C#) read Windows Server Task Scheduler job history/log

I have multiple scheduled jobs on a windows Server that run every night starting at 9 PM till midnight.
Is there any programmatic way (C#) to read (export) the Logs/History of each scheduled task and save it to SQL Server or as a text file within the server.
We are tying to show that data on a dashboard.
Thank You
I have researched on this issue and found a solution that worked for me. Created a sample project and is on GitHub.
Please check it out GetTaskSchedulerHistory
Thank You

Talend TAC export of list of tasks

I would like to take an export of the list of jobs that are created as tasks under job conductor in TAC along with its configurations. Is this possible and if yes, please support. I am using the Enterprise edition of Talend V5.6
There is an API to query the TAC called MetaServletCaller. Using this API, you can send a command to get a list of the tasks deployed in Job Conductor.
The API can be called from a url in a browser, or by calling MetaServletCaller.sh (or .bat) script from your Talend installation.
The command to get this list is listTasks.
Here is a tutorial on how to do that : http://edwardost.github.io/talend/di/2015/05/28/Using-the-TAC-API/
All TAC configuration is linked to DB tables. Just connect to this database (you can get the name through TAC, in Configuration>Database menu), and have a look at "executiontask" table, it contains all jobs deployed in Job Conductor, with Context/Job Version, etc.

Scheduling procedures in mongoDB in Windows

How can I create a mongodb procedure that can be scheduled to run once every day, at a fix time, say sharp at midnight GMT?
This google group link says you cannot schedule a task in mongoDB, they have a Jira for this, but you can use Window Task Scheduler which is described in this link. Is this the only way to achieve it? Is this a good way to do it?
Quoting the comment by #Markus,
As written in a different answer, running MongoDB on Windows is a bad idea for various reasons. Under Linux, you could use crond to run a .js file easily. If your requirement is to run MongoDB and have a reliable scheduler, the right tool for the job is Linux.
This answer also mentions the way to solve this.
This is done on Windows the same way you do on Linux.
ONE: Make a script in JavaScript to manage the task. This can be done in other languages if you prefer. This is a JavaScript script to rotate logs.
use admin
db.runCommand( { logRotate : 1 } )
TWO: Create a task in Task Scheduler to run the script. This can be done with the GUI, the API, or in XML. I usually set it up in the GUI and export the XML to allow parameterization of the database server, password, port, and user.
THREE: Include the execution of the script in the task
$MONGO_HOME/Mongo localhost:27017 -u myMongoServiceAccount -p somepassword LogRotate.js
The same concept can be applied to index management, gathering database stats, or managing stale locks.

Recover cron jobs through file structure

One of the drives on my server recently gave out and corrupted the OS. I was able to restore all the files, but now I have a backup drive with just the file system; not bootable. I'm setting up a new server now, and need to setup the old cron jobs. Is there a way to look through the file structure to see all cron jobs that were setup on the old server? Server was CentOS, not sure of version. Thanks in advance!
Crontabs belonging to individual users should be found in
/var/spool/cron/##USERNAME##
Whereas the server-wide crontab should be in
/etc/crontab