There are some clear warningssugestions in the documentation but very reasonable.
Customizing Start and Stop Behavior with ^%ZSTART and ^%ZSTOP Routines - Design Considerations
Using the ^ZMIRROR Routine
One issue to consider is on Failover or DR mirrors the code might need to be in ZMIRROR not ZSTART.

I don't think you need more than normal production code awareness.

This looks like what you want.

https://cedocs.intersystems.com/ens20171/csp/documatic/%25CSP.Documatic....

I would consider upgrading to the latest Cache before using compact and truncate.
Run an integrity check after to validate it didn't cause corruption.

Read this to see if applies

https://www.intersystems.com/product-alerts-advisories/alert-possible-da...

I would expect the WIJ to close to force it to the disk about every 80 seconds ie every write cycle.

my quick testing:

$while true; do
> ls -l IRIS.WIJ | cut -f 10-13 -d ' '
> sleep 40
> done
Oct 26 12:26 IRIS.WIJ
Oct 26 12:27 IRIS.WIJ
Oct 26 12:27 IRIS.WIJ
Oct 26 12:28 IRIS.WIJ
Oct 26 12:28 IRIS.WIJ
Oct 26 12:30 IRIS.WIJ
Oct 26 12:30 IRIS.WIJ
Oct 26 12:31 IRIS.WIJ
Oct 26 12:31 IRIS.WIJ
Oct 26 12:32 IRIS.WIJ
Oct 26 12:32 IRIS.WIJ
Oct 26 12:34 IRIS.WIJ
Oct 26 12:34 IRIS.WIJ
Oct 26 12:35 IRIS.WIJ
Oct 26 12:35 IRIS.WIJ
Oct 26 12:36 IRIS.WIJ

So testing shows the old way was better in this case.

Failure
iris session ${INST} -U %sys << EOF

w "stopping the mirror 1 is sucess: " zw ##class(SYS.Mirror).StopMirror("MIRROR")

h

EOF

%SYS>

%SYS>
stopping the mirror 1 is sucess: "0 "_$lb($lb(2050,,,,,,,,,$lb(,"%SYS",$lb("e^Shutdown+7^MIRRORMGR^2","e^zStopMirror+4^SYS.Mirror.1^1","e^^^0"))))/* ERROR #2050: Mirror configuration not loaded */

%SYS>
Sucess
$ iris session ${INST} -U %sys << EOF
>
> zw ##class(SYS.Mirror).StopMirror("MIRROR")                                  <
> h
> EOF


%SYS>

%SYS>
stopping the mirror 1 is sucess: 1

%SYS>

Same either way :(
iris session ${INST} -U %sys '##class(SYS.Mirror).StopMirror("MIRROR")' ;echo $?
0

An easy way is setup Operating System–Based Authentication
in %sys
^SECURITY
12) System parameter setup
2) Edit authentication options
Allow O/S authentication? Yes   

This allows scripts like this

iris session ${INST} -U %sys << EOF

w "stopping the mirror 1 is sucess: " zw ##class(SYS.Mirror).StopMirror("MIRROR") h
EOF
Once an IRIS LDAP account exists it does not appear to be different local account.

You can do this too:
iris session [instance] -U [namespace] tag^routine

The only way to get an estimate I can think of is running the compact against a SAN snapshot on similar hardware.
The free blocks could be anywhere in the file and that plays a big role.

Here are some numbers:
Current Size: 2332950 MB
Freespace at end of file: 300 MB
Total freespace: 8957 MB
Blocks Scanned: 10850564
It took 1 hour 44 minutes

The truncation was almost instant.