Jump to content
Ketarin forum

"exit 3" doesn't run post-update command


Recommended Posts

This might be by design, but I hope not.

Using "exit 3" in the pre-download command doesn't run post-update command, though "exit 3" means:

Skip downloading, but update the "last updated" date of the application and mark as "update downloaded". Allows you to use an external download application to download the file, but still mark it as properly updated in Ketarin.

I just noticed that using "exit 3" hasn't been running my post-update command, so it hasn't been updating my external logging system. I really need it to be able to use the standard post-update command so that it'll allow updates to push the results to my server.

I don't want to have to maintain the post-update command in multiple locations ("global" plus in each pre-update command for those that use "exit 3").

I know it's possible to parse the post-update command from the database and inject it in the pre-update command using powershell, but I'd prefer to not have to use more than "exit 3" if possible. If necessary, I'm open to using "open 4" or any other exit code to preserve backward compatibility and offer post-update only to the new exit code.


Link to comment
Share on other sites

  • 2 years later...

I've worked around this problem for now using the following method. This will reduce the number of times you have to edit your after-update script behaviors in a dozen or more places wherever you might use EXIT 3 and limits it to just two: the external text file and the real "after updating an application" script block.

1) Create a simple text file with the contents of the script you have in your "after updating an application" global script. 

2) Create a new global variable named "manualafterupdate" with the value (make sure the path is the correct location):

(Get-Content "D:\Ketarin\AfterUpdateCommand.txt" -Raw)

This will read the contents of the script into that global variable.

3) In those apps where you're using EXIT 3 add a new variable named "empty" with the following text contents:


4) Modify the app-specific before-update command to:

ECHO.Calling PS script.{empty:empty}


Now when you update that application it will run the powershell script you have stored in the file "D:\Ketarin\AfterUpdateCommand.txt" within the context of this app, same as if it were running the "after updating an application" global script.

Unfortunately, the "empty" app variable is a necessary middle step. Ketarin would not execute the powershell script in the correct context unless the second variable step is used. 

I may be the only person using this behavior but I use it in a lot of apps, so this is going to save me hours every time I update the after-updating an application script.

Link to comment
Share on other sites

Oh, I also added another feature to my templates.

Often when I'm using EXIT 3 it's because Ketarin is not working to download a file. Either I have to pass it to aria2, mega-get, or the download is behind a paywall/login that doesn't play well with Ketarin. To minimize some of the related issues while ensuring that it passes the proper context to my after-update script so it can send the correct data to the server I created a new global variable named "snodownload" with the value "https://www.iana.org/_img/bookmark_icon.ico". I always use a variable named "sdownload" to represent the download URL. This allows me to still capture the download url to "sdownload" and use "snodownload" in the download field so it will be a publicly accessible binary file (so Ketarin won't complain) and the after-update script still works. I don't have to go looking for a reliable binary link, just use the same global variable. Good stuff.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.