How can I stop the MathWorks Service Host from running on startup?

207 Ansichten (letzte 30 Tage)
How can I stop the MathWorks Service Host from running on startup?

Akzeptierte Antwort

Matthew Elmer
Matthew Elmer am 1 Aug. 2024
Bearbeitet: Matthew Elmer am 1 Aug. 2024
This answer that was given by the same person who asked the question is a lie. It's easily disabled.
The first and best option for disabling the MathWorks Service Host is to uninstall Matlab and use a better programming language.
If you are in the unfortunate position of needing to be able to run Matlab code due to its recalcitrance in being purged from our research institutions, then you can at least prevent the process from running on startup. I do not know the precise steps to disable the startup process on Windows, but you can probably find and disable it if you poke around in the startup applications settings. On Fedora 40 linux, you can either remove the entry from startup applications via Gnome Tweaks, or you can open
/home/$USER/.config/autostart/mathworks-service-host.desktop
and comment out the part that comes after the equals sign on the line that starts with Exec=, i.e., change
Exec=/home/$USER/.MathWorks/ServiceHost/-mw_shared_installs/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost service --realm-id companion@prod@production
to
Exec=#/home/$USER/.MathWorks/ServiceHost/-mw_shared_installs/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost service --realm-id companion@prod@production.
The audacity of MathWorks to attempt to tell me what I can and cannot do on my own computer is amusing, but foolish.
  2 Kommentare
Mike VanHorn
Mike VanHorn am 1 Aug. 2024
@Matthew Elmer This is good information, but it is useful only when the user has already run the software once. Is there a way to "pre-comment this out" before the user has run the software? I figure I can pre-create the mathworks-service-host.desktop for newly created accounts, but I don't want to have to touch every account which already exists but hasn't run R2024a yet.
I did a search through the install directory, and I didn't find a "mathworks-service-host.desktop" file that could be modified, which I think means it's either compressed somewhere waiting to be deployed when the application starts or it just creates it from scratch.
I guess what I'll do for now is put the modified "mathworks-service-host.desktop" into the skel files for new accounts, and create a script to run through all the existing home directories.
Thanks!
Mike VanHorn
Mike VanHorn am 1 Aug. 2024
Bearbeitet: Mike VanHorn am 1 Aug. 2024
@Matthew Elmer Further testing shows that while commenting out the line in the "mathworks-service-host.desktop" does keep the service from starting at login, the client still gets started when Matlab runs. So, my method of symlinking $HOME/.MathWorks/ServiceHost to a place in the local /tmp directory is still necessary to work around the incredible slowness associated with the creation of that directory the first time a user runs MATLAB (as the client runs from $HOME/.MathWorks/ServiceHost). For those who aren't paying attention, the Service Host installer puts 1.4GB of files into $HOME/.MathWorks/ServiceHost.
So, anyway, still looking for a way to disable the ServiceHost. But, on the bright side, it seems that the ServiceHost processes do get killed when the user logs out, so at least they aren't running rampant.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Mike VanHorn
Mike VanHorn am 1 Aug. 2024
Bearbeitet: Mike VanHorn am 1 Aug. 2024
Also, I can confirm this answer is at least partially false.
I tried removing $HOME/.MathWorks/ServiceHost/wilbur26/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost, and while MATLAB start up was then slow, it did start up, and the licensing was fine. So MathWorksServiceHost seems to be NOT "essential for MATLAB licensing and MATLAB startup". I'm thinking it must only be related the MATLAB Connector.
However, there does, indeed, seem to be no way to disable it, and rather only work around it's slowness.

Dimitrios Kikidis
Dimitrios Kikidis am 2 Sep. 2024
Hi Matthew,
In order to disable MathWorks Service Host from starting at Operating System login, you can:
Windows: Follow these instructions of Microsoft to toggle off the Mathworks Service Host startup
Linux: Delete this file: ~/.config/autostart/mathworks-service-host.desktop
macOS: Delete this file: ~/Library/LaunchAgents/com.mathworks.mathworksservicehost.agent.plist
If these files are deleted, MathWorks Service Host will honour this choice and will not re-create them. However modifying the files, as suggested in other answers, will not work for very long, as they will be updated when MathWorks Service Host is updated.
Please note that MathWorks Service Host will still run when MATLAB is started, and that MathWorks Service Host is required for the correct functioning of MATLAB R2024a and later.
  2 Kommentare
Mike VanHorn
Mike VanHorn am 4 Sep. 2024
As I already posted, "MathWorks Service Host is required for the correct functioning of MATLAB R2024a and later" seems to be false, as I was able to disable it entirely and MATLAB still seemed to work just fine. If you could please explain exactly what MathWorks Service Host does, perhaps we would better understand the need for it. From the outside, all it seem to do is slow down the startup of MATLAB, which is pretty slow to start with.
Also, if the modifications I have made to certain files get overwritten when MATLAB is updated, there will be a HUGE explosion of extremely pissed of systems administrators. The second an application starts overwriting user files not associated with the application and housed on an entirely different server, it becomes a security issue and the application goes away very quickly, no matter the precieved "need".
Dimitrios Kikidis
Dimitrios Kikidis am 4 Sep. 2024
Hi Mike,
You are absolutely right, lots of MATLAB functionality will not be impacted by the absence of MathWorks Service Host, but disabling it will cause performance and/or functional issues for many users. MathWorks Service Host, although a separate process, is part of MATLAB, so disabling it is something similar to deleting files from the installation of a program, it may work some times but there is a high possibility that you may break something.
Regarding the MATLAB startup time, if MathWorks Service Host is already running it should not slow down MATLAB.
Thank you for the feedback regarding the modification of the autostart file. Since these files are owned / created by MathWorks Service Host, we thought that it is reasonable to update them when MathWorks Service Host is updated. If the files are deleted, we will honour that and not recreate them. Deleting the files is therefore the recommended solution to opt-out, rather than modifying them, which will only work temporarily.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by