Running external python and Bash linux scripts from Ignition and handling the returned values

Hello

I would like to run an external Bash script in Ignition. This is to be used to save the Ignition bacup to the cloud. Backups periodically create themselves on the disk, however, it depends on their continuous saving to the mentioned place.

After saving, I would like Ignition to receive information about whether the backup was successfully exported to the cloud or whether it failed for some reason. What might be the best way to approach this?

Also a general question for other cases. Suppose I have an external python script that I run from within Ignition. I would like the returned information from this script to go to Ingition. How to do this in a reliable way.

Regards
Michal

In the case of saving the backups to the cloud, I'd probably avoid running this from ignition.
A cron task can do it without ignition having anything to say about it.
If you want to make sure from ignition itself that the upload was successful, I'd probably just log every upload to a database, then check that from ignition.

As for the more general question... It really depends on the use case.
The general advice I'd give would be: use APIs. If you have specific use cases in mind, explain them so we can help figure out the best methodology.

2 Likes

Use java's ProcessBuilder to launch your external process with input/output/error pipes and completion monitoring (to get the exit code). Standard java stuff, just called from jython.

1 Like