Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Reinstalling job

$
0
0

Hi,

We have developped a timer job for an existing Sharepoint site.

So far, so good: the first update does add the job properly. Then comes the problem.

I programatically delete the added job with a powershell script :

$job=Get-SPTimerJob | where { $_.title -like "*nettoyage des récépissés*" } |select id, name, title

if ($job.Count -gt 1)
{
    Write-Host ("`nToo many jobs found ! Total :" + $job.Count)
}
elseIf([string]::IsNullOrEmpty($job.id))
{
    Write-Host "`nNo job found !"
}
else
{

Write-Host "`nJob Suppression`n" -ForegroundColor Yellow
        $fullJobObj=Get-SPTimerJob -id $job.id
        
        $fullJobObj.Delete()
        IISRESET
        net stop "SharePoint 2010 Timer"
        Start-Sleep -s 3
        net start "SharePoint 2010 Timer"

}

Then, I want the job to reappear when I update again the solution.

The script being used for the update if the following (it is the same I use the first time):

Write-Host "`nUpdating WSP solution`n" -ForegroundColor Green
$path = Get-Location
$fullpath = $path.ToString() + "\WSP\xx.yy.wsp"
Update-SPSolution -identity xx.yy.wsp -LiteralPath $fullpath -GACDeployment -Force

Write-Host "`nRebooting Sharepoint`n" -ForegroundColor Yellow

IISRESET

net stop "SharePoint 2010 Timer"
Start-Sleep -s 3
net start "SharePoint 2010 Timer"

Updating the second time does not create the job (EDIT: it cannot be found by any means, nor title nor GUID). I do not use "stsadm -o execadmsvcjobs"after the Sharepoint reboot as I understand it only forces jobs to run immediately.

Now you may ask why I do the delete in the first place ? The reason is: on our dev server, things run nicely. On the test server however, updating the Sharepoint site does not create the jobat all. Being unable to reproduce this bug on our dev server, we simulate the bug by installing WSP / deleting the new job.

Did I miss something ?




Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>