Manually start SharePoint timer job - sharepoint

I'd like to invoke a timer job installed on a SharePoint server manually. What would be useful is something along the lines of an stsadm command.
My scenario is, I've deployed a solution with a bunch of features to a customers server. I don't want to wait for the weekly schedule to kick a particular timer job to life. I would like to just punch in a command to get the specific job to run immediately. Obviously in the development enviroment I've got the schedule set for a few minutes but I want to do a test run while I'm on site with the customer.

You can develop a custom command line based tool that gets the job's SPJobDefiniton based on the criteria that identifies your job from the service.JobDefinitions collection. From there you can execute it using the Execute() method.

Related

Netsuite scheduled script https post fail while other scheduled script run

In NetSuite, we created a scheduled script that will run every day to fetch the bank account information.
For that, we use the HTTPS post method.
After a few months of testing and different customers, we figured out that if we have a customer with no other running script, it is working perfectly but if the customer has too much script running, instead of waiting, we have
SSS_INVALID_HOST_CERT An untrusted, unsupported, or invalid
certificate was found for this host.
The only way is to trigger the script manually at a specific hour like 08:57 to avoid the script running every 15min, 30min, ...
Has someone already had this kind of issue?
Is there a trick to scheduling the script at a precise hour?

Hybris catalog cronjob sync is not working

For the first time when we run the sync cronjob (product/content) sync, it runs properly and creates media dump in the admin tab.
from next time when we run it, it just shows successful but actually, sync does not happen.
When I go back and clear the media dump from the admin tab, it starts working and again creats media dump.
So every time I am forced to manually clear the media dump for making this sync job to work.
please advise.
CatalogVersionSyncJob is designed to run only once with each instance. So if we create a sync job instance by ImpEx/HMC, it'll work for first time but in the second execution, it won't get any newly/modified items and no item will be synced. Which mean, the system needs a new instance for each sync execution!
If we execute catalog sync from Catalog Management Tool(HMC/backoffice), then each time, it internally creates a new instance of selected sync job. Hence, it's working.
To solve this, write the custom job which basically does the same thing as HMC/backoffice does internally. Like creates a new instance, assign sync job, and execute it.
For more information, refer configure-catalog-sync-cronjob-Hybris
I've encountered this issue, and the workaround was to create another CronJob that would remove those media dumps before the sync runs.
At a high-level we have a CompositeCronJob that does two things (there are actually more, but I'll just say we have 2 for the sake of this issue) in sequence:
Remove the media dump from the Sync CronJob
Sync CronJob

Running a python based command line script as cronjob on gcloud

I have a python3 based command line script which does the job of report generation for services running online. I am able to successfully schedule it as a cronjob using crontab and some shell script to run that script on weekly basis.
But now, I wish to update and make this script run as a cronjob on gcloud.
Can you provide me any ideas or references, from where I will be able to achieve that?
Note that platform is restricted to google cloud only.
Thanks!
You can use App Engine Cron Service:
The App Engine Cron Service allows you to configure regularly
scheduled tasks that operate at defined times or regular intervals.
These tasks are commonly known as cron jobs. These cron jobs are
automatically triggered by the App Engine Cron Service. For instance,
you might use a cron job to send out an email report on a daily basis,
or to update some cached data every 10 minutes, or refresh summary
information once an hour.
Create a service like /tasks/summary and schedule it to run each week Monday morning via cron.yaml:
cron:
- description: weekly summary job
url: /tasks/summary
target: beta
schedule: every monday 09:00

How to setup a cron job in SQLyog

I want to create a scheduled job in SQLyog (or suggest me if any) that will run a SQL query every 30 minutes.
I want to run the query -
UPDATE `db`.`table` SET sessiontime = CEILING(sessiontime/6)*6 WHERE id>1000
Please help me to figure out this.
Thanks
First, SQLyog is a windows tool for managing MySQL databases. Windows usually don't have a cron, instead it has the Windows Task Scheduler.
SQLyog has something build in which is called the Job Agent, which allows you to execute queries and generate, format and send personalized mails with results. These jobs are saved as XML files, which can be executed with SQLyog. This is used to use the Windows Task Scheduler for performing regular querying (as a matter of fact, you can either put them there if you want to or use SQLyog to do this for you).
Basically, use the wizard to put in all the data required (database connection, smtp options, query), test it, then use the Job Agent to put this into the Windows Task Scheduler.
Keep in mind, the feature Job Agent is available in SQLyog Enterprise and Ultimate only. The free edition doesn't have it unlocked.

Jenkins to monitor external cron jobs

We are using a dedicated Amazon Ubuntu ec2 instance as Cron server, which executed 16 cron jobs at different time intervals i.e, 10 cron jobs in morning 4:15 - 7:15 and the rest # 23:00 - 23:50. I get the results via email. I want to configure something, which shoots email message at the end of they day listing the cron jobs that are executed successfully and the one that failed.
I have a jenkins configured ubuntu instance for auto-building Dev, Beta, Staging & Live environments. Can i add these cron jobs(shell scripts) as external jobs in the jenkins and monitor them. Is it possible?
Definitely possible! You can monitor external cron jobs as described here:
https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs
You can also add cron job (-like behavior) to Jenkins by creating a freestyle software project and add "Execute shell" as build process.
It's a bit more convenient since you can also trigger the execution via Jenkins ("Build now").
You might be able to combine the Jenkins monitor external job project type with a matrix project. At the very least the former will enable you to monitor the cron jobs individually.
Alternatively you could have the last monitored cron job of the day trigger building a project that checks the status of all the cron jobs (for example by retrieving and comparing the build numbers of the last and the last successful builds) and sends an email accordingly. The email plugin might be useful for the latter.
Check the CPAN or do some web digging for shell or perl script for managing cron jobs and extend its behaviour to do some reporting which you can render using HTML. Alternatively write a servlet and a some function calls to do just that.
This becomes your own standalone monitor application, which can sit in jenkins or deployed independently. If you choose to add it to jenkins, then add the reporting HTML file and its scripts to the container holding deployed web files for jenkins, word of advice place your files and script in a separate container.
Add a hyperlink to jenkins index html which will load your reporter. Now reboot tomcat and go from there.
Another option could be to take a look at Cronitor (https://cronitor.io). It basically boils down to being a tracking beacon that uses http requests to ping when a cron job/scheduled task starts and ends.
You'll be notified if your job doesn't run on schedule, or if it runs for too long/too short, etc. You can also configure it to send alerts to you via email, sms, but also Slack, Hipchat, Pagerduty and others.

Resources