I have setup several custom scheduled jobs in my ClearCase Task Scheduler, these jobs are supposed to do automated sync and we usually have no problem with them.
Occasionally the jobs might fail, and I am looking for a CLI way of querying the status of these scheduled jobs and generate a basic report.
Is there such a CLI utility?
The cleartool schedule presented in Viewing job properties seems complete enough:
To view messages and information such as time and status from the last execution of the job, use this command:
cleartool schedule –status job-id-or-name
These commands display properties of jobs by using the job-definition syntax documented on the schedule reference page.
Related
Running a Cmd.exe inside an ETL Process Task and it's failing with Exit code 1.
If I run the command as the same user I'm running the SQL Agent job as outside of the ETL it's running fine and giving Exit code 0.
I've seen some DCOM errors in Event Viewer and Ive taken steps to give permissions to the user I'm running the ETL through the SQL Agent Job for. However it's still failing.
Are there other things I should check about running a CMD command across servers as a specific user?
Just to say this was a permission issue ultimately for it to write a file inside the Default folder. It wasn't manifesting as such until I dumped out the Log a little more. I had to make the user I was running the agent job to be a part of the Administrators group on the SSIS server to allow the process to work.
I'm using the msdb.dbo.sp_help_jobhistory to get the history of each step that has executed in each package which is I believe the same query executed if doing a view history on the right click of the job.
My problem is there doesn't seem to be any way of tying a run of a job together. E.g.
What I need to do is tie it up like it does in the UI to each run of the job:
Use sysjobs, sysjobhistory, sysjobactivity, and sysjobschedules (all found in the msdb database). You can tie everything together using job_id.
Hopefully this question is unique enough not to be a duplicate. I have a PowerShell script which does two things.
Inserts records into a SQL Server table
Writes text to a text file
For the purpose of this post, I have simplified the script. On my computer, the script is located at C:\Temp\ssis.ps1. Following is the contents of the script.
DTEXEC.EXE /F "C:\Temp\ssisjob.dtsx"
$date = Get-Date
Write-Output "This PowerShell script file was last run on $date" >> C:\Temp\test.txt
When I manually run this PowerShell script, records are inserted into the SQL Server table, and a line of text is written to the test.txt file. If I schedule this script to run using Windows Task Scheduler, a new line of text is written to the text file, but the records are not inserted into the SQL Server table. This tells me that Windows Task Scheduler is able to run the PowerShell script. However, for some unknown reason, Windows Task Scheduler seems to not want to run the SSIS job (DTEXEC.EXE) part of the script. Event Viewer confirms there is an issue with the SSIS job. I am running Microsoft SQL Server 2014, Developer Version.
In my task, on the Actions tab, the Add arguments field has the following reference: C:\Temp\ssis.ps1. Task Scheduler is configured to run with the highest privileges.
I have tried all of the following Execution Policies in PowerShell. Regardless of the Execution Policy I select, my experience does not change.
Bypass
Unrestricted
RemoteSigned
The History tab in Task Scheduler has information events, but no error events.
I do not have the permission to view the SQL Server logs (this is a production server).
I have been debugging this issue for a few weeks, and I have read numerous posts here on Stack Overflow, yet I still cannot seem to find the answer, so hopefully I have done my due diligence before making a new post here. I could add some additional observations, but I do not want my post here to get extensively long. If anyone has any hints or tips or insight that might lead me down the right path, it would be greatly appreciated.
Here is the solution I came up with. Instead of exporting the file to Excel, I exported to a flat file (txt file). Also, using Nick McDermaids excellent recommendations, instead of using PowerShell in Task Scheduler, I started the dtexec.exe file in Task Scheduler.
Task Sheduler Actions Tab
Keep the action as Start a program
In Program/script, type dtexec.exe
In Add arguments, type /f "C:\path\to\example.dtsx
Leave the Start In box empty
I have set several batch file in cron and few cron jobs runs for a hour.
I want to see which cron job is running right now and what is its status. Is it possible to watch it.
Thanks
It is possible to see what processes are running by typing ps -aux in your console. You can also use utility like top which shows You what processes are running in realtime.
Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?
Assuming you run it on Windows Server 2003/2008 or Vista, use SSIS Execute Process Task to start SCHTASKS.EXE with appropriate params (SCHTASKS /Run /? to see details).
It should be possible as the Task Scheduler has a scriptable COM API that can be used for interacting with tasks.
You could therefore either create a custom task that uses COM interop to call the Task Scheduler API, or it'd probably be quicker to use an Active X Script task to do your dirty work.
I invested a lot of time in the aforementioned COM API back in 2002. It was, to put it mildly, "flakey".
What we ended up doing instead is having our tasks run every minute. The first thing the task did was check the database to see if it should continue running or not.
Then "starting" a scheduled task from SSIS was as simple as changing a database field.