Running the same file before update

If we have a utility script that needs to be run before each update is there a way to ensure that it runs without having to update the file so wyUpdate knows to run it? Currently, it seems that if we call a specific file to run it will ignore it if was run in a previous update and the file has not changed.

Here is the real reason for the question - I know that we have discussed backup options in a previous thread (Perhaps, you already have a solution for this too), but I need to make a full copy back up of our server application directory that can be used some time after the update has completed in case we made a "boo boo" in our actual application and need to roll the whole thing back. I may have misunderstood how your back up works, but I thought that it was destroyed once the update process is successful.

Hopefully we are able to reuse your back up, but I know in another product implementation I will need the ability to run the same file over each time where the application server does not change (Everything else around it will).

As always, thank you for taking the time to review this.

Jim

Hey Jim,

If we have a utility script that needs to be run before each update is there a way to ensure that it runs without having to update the file so wyUpdate knows to run it? Currently, it seems that if we call a specific file to run it will ignore it if was run in a previous update and the file has not changed.

Are you setting the file to execute in every new version? It sounds like you might be just setting it once in an old version and you expect it to run every time a user updates.

I may have misunderstood how your back up works, but I thought that it was destroyed once the update process is successful.

Yep, that's exactly how it works. Once the update is sucessful the backup is removed.

Response your previous comment - "Are you setting the file to execute in every new version? It sounds like you might be just setting it once in an old version and you expect it to run every time a user updates."

I went back and retested the situation and I certainly have them configured for each version. However, it was my mistake (Which I'm sure you are jumping up and down about 🤣 ). I'm finding myself creating a hack in running the script when running in the "Temporary Folder". I need to call another file within that same folder, but my working directory gets changed to wherever the wyUpdate.exe application is running. I found out that hard way (and confirmed that much in another thread) that you can't use the %temp% variable to find this directory. Here is the thread:

https://wyday.com/forum/t/1201/non-zero-return-code-using-sqlcmd-rollback-facilities/#post-6300

However, wyatt mentioned in that article to pull the working directory path from the batch file running in that location. I have to say that I can't do that, but the person's response brought up the critical point I wish I thought of before which is using the "%~dp0" variable which will help resolve this issue.

Jim

that you can't use the %temp% variable to find this directory. Here is the thread:

Just FYI, we're adding the %wu-temp% variable that can be passed to executables in wyBuild 2.6.18 (coming soon).

Excellent. Thank you Wyatt.