is it possible to stop/kill Mathematica Frontend from wolframscript?

88 views Asked by At

I use wolframscript to generate hundreds of images like this visualization of 4fold symmetry of octahedron (to be combined in animation videos) like so:

      Map[
       Export[
          "img" <> IntegerString[# , 10, 6] <> ".jpg",
          Show[
              (* Graphics3D with >300,000 polygons *),
      
              ViewVector -> {#, {0,0,#[[3]]}}& @ viewPoints[[#]],
              ViewVertical -> {0, 0, 1},
              ViewAngle -> 35 Degree,
              ImageSize -> Large
          ]
       ] &,
       Range[ ToExpression[#[[1]]], ToExpression[#[[2]]] ]& @ Rest[$ScriptCommandLine]
      ]

Due to the memory leak in Mathematica Frontend 12.1.1 triggered by the rasterizing operation in FE I'm forced to run the script piecewise from a shell script like this

./hp-h+h-bps+ghp-t7-s2-9.wls 1 5
./hp-h+h-bps+ghp-t7-s2-9.wls 6 10
./hp-h+h-bps+ghp-t7-s2-9.wls 11 15
...
./hp-h+h-bps+ghp-t7-s2-9.wls 191 195
./hp-h+h-bps+ghp-t7-s2-9.wls 196 200

Is it possible to kill the frontend from within wolframscript? (Run["kill -9 pidOfMathematicaServer"] will not work because this would also kill the kernel which spawned the FE.)

1

There are 1 answers

0
rlj On

ihojnicki answered on mathematica.stackexchange: "You can release your copy of the FrontEnd via Developer`UninstallFrontEnd[]."

Works very well and lets me get rid of the shell script.