Restart Sikuli script after error - calling from command line - sikuli

If I run a script manually from the IDE and it errors out somewhere, I am able to just hit Run again and it continues from where it left off. If I call a script from command line, is there any way to do this?
Running it from command line does not open the IDE, it just starts running the script and if it fails, I am not notified in any way, nor do I see a way to restart the process. I am using command line because it is an automated task that runs on its own.

Decided to go another route as I found out this is not possible.

Related

DotTrace detaches after sent start command

I am attempting to use the DotTrace command line tool self profile my application (I would use the NuGet, but it has a blocking bug.)
It starts up just fine. I create the dotTrace process and attach it to my application. I then use standard in to send it the "##dotTrace["start"] command. I have done this in a demo app and my real app. In the demo app, it starts profiling after that command is sent.
In my real app it responds with "##dotTrace["disconnected"... as if I had sent a ##dotTrace["disconnect"] command.
It does not give any indication why it detached, just does it as if I had requested it.
How can I figure out why detach was called?
Looks like the profiler crashed just after start. Could you please add --core-log-mask=55 to the dotTrace command line? It will generate a log file in %temp%\JetLogs. Please, share the folder JetLogs after that.

InstallShield 2014, Custom Actions and executing sql files into MySQL

I am building an installer for our product which works well. I've managed to build custom actions to install our services including a MySQL server.
The problem I have is executing a sql file to build the schema structures.
I have a custom action which uses mysql.exe and the command line arguments:
--port=### --user=### --password=### < "[INSTALLDIR]db\EmptyStruct.sql"
It tries to execute this ok but the cmd window which pops up, during the install, just runs through the mysql.exe command line options, which says to me that the command line it gets passed is not correct. However if I run the command manually after the install, it works perfectly.
Does anyone has any ideas please.
I'm making a few assumptions here:
You have a Windows Installer exe custom action that specifies mysql.exe and a command line as you showed
You are expecting the contents of [INSTALLDIR]db\EmptyStruct.sql to be redirected to mysql.exe's standard input
This will not happen. Behind the scenes, Windows Installer's exe custom action support uses the CreateProcess API and this API will interpret command lines literally. However the redirect < needs special handling to actually perform redirection.
To get that behavior, you must use a layer of indirection. For example, you could run cmd.exe as the exe, and give it a command line that will make it interpret and run the command line mysql.exe --port= ... < "[INSTALLDIR]...". However, if you didn't already have a command prompt showing, this would cause one to show up. If you want to avoid that, you could write a custom wrapper that performs the redirection for you, either as a C++ DLL or, say, InstallScript action.
Alternately, if there is a parameter that tells mysql.exe to run a script from a file, you could pass that instead of using redirection. I wasn't able to find evidence of such a parameter in a quick web search.
Thanks for your comments Michael and I used cmd.exe /k AddStruct.bat to accomplish the task!

Execute a script located on Zabbix server on trigger

We are monitoring our production environments using Zabbix 2.4. New instances are provisioned with Ansible that sets up a Zabbix agent. What we need is for hosts to be removed from the server if they have been terminated so that we only receive messages about running instances becoming unavailable.
To do this I wrote a Python script that can take a zabbix host name as an argument, check if that host is on the list of running instances by calling awscli and delete the host if it's not on a "not terminated" list.
I put the script in /usr/bin/delete_host.py and configured an action to call for it when a "Agent not available" trigger is activated. This is how the Operation tab looks like link
And here is the Action Log link
I've tried a couple of ways to write the command, also placed the script in ExternalScripts directory. Turned on debug logs for the server but nothing in it mentioned an error or anything. In fact it only showed messages that command is being executed and everything is ok, but the host is still there. When I copy the command from Action Log and execute it manually everything works fine.
At this point I am really out of options on how to troubleshoot this further. I disabled selinux and added zabbix user to sudoers file with nopasswd. I can't find anything in any logs. Is it even possible to execute non-messaging scripts with zabbix?
Try to write the script in a way that will print "OK" or 0 if it ran properly and the error message or error code if it fails. Run the script using an active zabbix agent item on the Zabbix server host (use the function system.run). In this way you'll be able to create a trigger that will raise an error if the script fails to run.
You can also just schedule it using a different tool such as Rundeck.
The script does not have to be in the ExternalScripts directory, that is only required for items of type "external check". The operation screenshot you linked to uses relative path of delete_host.py, and that is almost guaranteed not to work. Your action log screenshot shows a few entries with /usr/bin/ prefixed, which is better.
At least for testing, make sure to specify full path to everything, including the python binary, for example /full/path/to/python /full/path/to/delete_host.py.
You also had a few entries that redirected all output to a file in /tmp/, but you didn't mention what got logged in there. Please use that approach and check the potential error messages as well.
Remote commands from "Actions" are run using the key system.run[command,nowait]. This "nowait" key returns 1 irrespective of the command result.
Try running system.run with "wait" parameter and see what the actual error is under "Latest data".
For me the error was "sudo: sorry, you must have a tty to run sudo" even i had "Defaults:zabbix !requiretty" in the sudoers file. I commented out the "#Defaults requiretty" line in /etc/sudoers file and it worked.

How do I use html5bolierplate build script?

Okay, so.
I've installed Ant.
Downloaded the build script. Extracted to Ant installation location.
When I run the 'runbuildscript' a cmd interface opens for around a second, and stops.
If I navigate to the location of files through CMD, then do ant minify it doesn't work.
I then thought to place and extract the build script in the location of the files.
Upon doing so, an error came -
BUILD FAILED
E:\NamanyayG\wamp\www\namanyayg\build.xml:150: The following error occurred whil
e executing this line:
E:\NamanyayG\wamp\www\namanyayg\build.xml:416: E:\NamanyayG\wamp\www\${dir.source} does not exist.
Please help me out, I'm thoroughly confused.
Build script expects some external process (in this case you) to set dir.source property.
The most sure way to set it is to define it on ant command line, e.g.
ant -Ddir.source=/path/to/dir.source

How can I run hg commands in the background (without showing the command prompt window)?

I am using firefox extension to run hg commands on my repository. But when ever I execute any hg commands it shows command prompt window for a split second and closes it.
Eg:-
process.run("push");
process.run("update");
Is there any way to not show that window at all ?
Back in the day I used to have a tool that was hidewin.exe that would all you to start any bat file or exe file and have it run invisibly. I tried a google search for it but didn't find it easily but maybe you could have better luck at finding it.