I wondering how Azure Webjob works.
If I put any .exe file to D:\home\site\wwwroot\App_Data\jobs\triggered\sample>
with file Settings.job
{
"schedule": "0 */1 * * * *"
}
then that .exe file will be executed every minute? How Azure know which file should trigger? Does he just look for any exe file?
I create 3 .bat file to test.
When kudu executes webjob, it will find the first matching file type (.bat, .exe, .py and so on) according to the naming rules, and run it.
My Test Steps
Create webjob{num}.bat file with below script.
#ECHO OFF
echo Hello World webjob{num}!
I create webjob on portal by upload .bat file. Then drop and paste another two .bat file to the path of webjob1 folder.
I check the log, I found that when kudu executes webjob, it will only run one file. After testing, the first file will be run according to the naming rules.
Related
In Azure DevOps, I have an Azure Powershell task to create some resources using ps1 script in repo. This script working fine.
Now I need to split the script and variables into different files.
I created files SB-Config.ps1 for variables and ServiceBus.ps1 with main script. Moved all vars into SB-Config.ps1 .
Both files are in the same folder and in ServiceBus.ps1 I added:
. .\SB-Config.ps1
But Azure Devops fails with error:
What I'm doing wrong and how to get variables from SB-Config.ps1 script, when running ServiceBus.ps1 file?
I am able to reproduce your situation on my side.
Same issue as yours.
You can run this command to output the location of current work space:
Get-Location
I notice the powershell script file on your side is in the sub folder of Default working directory.
So do you set the work space in the powershell script file you are running first?
Set-Location $env:System_DefaultWorkingDirectory\subfolders
In your situation, I think the issue comes from the current work space is System_DefaultWorkingDirectory , the error output means the script can't get the file you want. This issue only occurs when you select 'file path' to run.
I'm running Cypress in one of my release stages and it gives me this output:
Finished processing: D:\a\r1\a\_ClientWeb-Build-CI\ShellArtifact\tests\integration\cypress\videos\onboarding.spec.js.mp4 (0 seconds)
I have 2 questions:
Is the path name relative to the app service? If I have a app service called randomname and run the Cypress Stage on that randomname app service should I be able to find tCypresshe output in randomname.scm.azurewebsites.net.
If I go into the scm debug console and I do cd D:\a\ I get:
cd : Cannot find path 'D:\a\' because it does not exist.
So how do I actually access my Cypress test results?
I've also tried archiving the files into a zip file:
In the output of the task step I see:
Creating archive: d:\home\testing\somefile.zip
But when I try to access the D:/home/testing folder on my appname.scm.azurewebsites.net I get:
cd : Cannot find path 'D:\home\testing' because it does not exist.
The path D:\a\r1\a is inside the hosted agent that run the release pipeline, is not in your application.
The same thing is for the zip file, when you specify d:/home/... is in the agent.
After the release is finish all the files are deleted, so you need to save the file in another place (maybe in azure?) during the pipeline, for example, with "Azure File Copy" task.
I use pretty much standard custom kudu deployment script for asp.net core web app for external git deployment.
I managed to run the script mostly successfully, through mingling with SCM_COMMAND_IDLE_TIMEOUT and .cmd files encoding. My deployment scripts look as follows:
.deployment
[config]
command = deploy.cmd
deploy.cmd
#echo off
IF "%WEBSITE_SITE_TYPE%" == "<project_name>" (
.\<project folder>\Properties\deploy.cmd
goto end
)
echo Unknown WEBSITE_SITE_TYPE: "%WEBSITE_SITE_TYPE%". Expected one of the "<project name>"
:end
exit /b
.\<project folder>\Properties\deploy.cmd - regular asp.net core deploy.cmd script, updated for proper folder structure.
The WEBSITE_SITE_TYPE is a custom environment variable I added to the web app.
All these scripts saved with utf-8 without BOM encoding.
But even though the scripts look like runs successfully, the final state of the deployment process is Failed.
When looking into the kudu deployment log last few lines of the log look as follows:
...
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\runtime.ec2944dd8b20ec099bf3.js',,0
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\styles.8ef9ef86d2a54ed3748c.css',,0
2018-10-14T20:50:51.0816988Z,Deleting app_offline.htm,,0
2018-10-14T20:50:51.0816988Z,Finished successfully.,,0
2018-10-14T20:50:51.1129431Z,\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11002.3584\bin\Scripts\starter.cmd deploy.cmd,,2
Apparently the last line returns error code 2 and it might cause the script status to fail. But what does it mean and how do I fix it?
i'm trying to run a simple executable using an Azure Web Role.
The executable is stored in the Web Role's local storage.
The executable produces a log.txt file once it has been run.
This is the method I am using to run the executable:
public void RunExecutable(string path)
{
Process.Start(path);
}
Where path is localStorage.RootPath + "Application.exe"
The problem I am facing is that when I open the local storage folder the executable is there however there is no log.txt file.
I have tested the executable, it works if I manually run it, it produces the log.txt file.
Can anyone see the problem?
Try setting an explicit WorkingDirectory for the process... I wonder if log.txt is being created, just not where you expect. (Or perhaps the app is trying to create log.txt but failing because of the permissions on the directory it's trying to create it in.)
If you remote desktop into the instance, can't you find the file created at E:\approot\ folder ? As Steve said, using a WorkingDirectory for the process will fix the issue
You can use Environment.GetEnvironmentVariable("RoleRoot") to construct the URL to your application root
Hi I test my web on my localhost(winxp+ie8+mysql5.0.51a+PHP 5.2.11+Apache 2.2.13). I want to add some cron job for my php files. I select Pycron. After configuration, I add some command in crontab.txt * * * * * "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://localhost/test/index1.php. It is success, it will open IEXPLORE.EXE and load index1.php for every minute. But it still open the IEXPLORE windows, not for close. how to set it automatic finish the php job, then close the IEXPLORE windows? thanks.
how about using a command-line utility such as Curl or wget: http://gnuwin32.sourceforge.net/packages/wget.htm? Or use Python with urllib/urllib2?
To fire a local PHP event through Pycron, you'll want to do something like this:
First create a new task. Then for the "Command" box in Pycron, enter the location of your PHP.exe file, eg "C:\Program Files (x86)\PHP\v5.3\php.exe"
for the "Parameters" box enter the location of the php file you want to run eg "C:\websites\mysite.com\cron.php"
You don't want to run any of that through Internet Explorer. Fire it directly at the PHP executable. Your server will thank you.