How to make TeamViewer service be on-demand rather than always-on?
5
votes
1
answer
2112
views
I am on Linux Mint 19.3 and would like to make the TeamViewer systemd service only run when I launch the GUI app (
/opt/teamviewer/tv_bin/script/teamviewer
). On Windows, this is fairly easy to do from the Services dialog by selecting the TeamViewer and changing its "Startup Type" from "Automatic" to "Manual".
In Linux, I have TeamViewer 15 (installed via deb file from official site). I am seeing that the systemd service file has:
$ cat /etc/systemd/system/teamviewerd.service
[Unit]
Description = TeamViewer remote control daemon
After = network.target network-online.target dbus.service
Wants = network-online.target
Requires = dbus.service
[Service]
Type = forking
PIDFile = /var/run/teamviewerd.pid
ExecStart = /opt/teamviewer/tv_bin/teamviewerd -d
Restart = on-abort
StartLimitInterval = 60
StartLimitBurst = 10
[Install]
WantedBy = multi-user.target
and the service autostarts during login which I don't want. I don't mind hacking out a new bash script to start the service just before launching the gui but I'm not great with editing systemd services and had a concern about new versions overwriting my changes.
### Questions:
1. I could probably just remove the service file and use a bash wrapper script just before/after the gui process starts/ends vs just launching its 'ExecStart' args directly. *BUT*... seems like this could be bad if the gui process were to interface with the service process using systemd calls... If I were going to keep the systemd service file around for better compat, is there a way to configure the service file to still have the service enabled but NOT to run on startup but still allow it to be manually controlled via sudo systemctl [start|stop] teamviewerd
?
2. Is there a way in apt
to specify a post-install script for a particular package. (e.g. when apt
etc installs a new version of teamviewer which presumably reinstalls the systemd service and *.desktop files, I would like to have it automatically run a script to "fix" those things). I saw [this](https://www.cyberciti.biz/faq/debian-ubuntu-linux-hook-a-script-command-to-apt-get-upgrade-command/) and [this](https://askubuntu.com/questions/869219/how-can-i-run-a-script-after-a-specific-package-is-upgraded) and get that I would need something like /etc/apt/apt.conf.d/custom-hooks
with a path to a script but not seeing how to: a) pass a list of last installed packages or b) find out which packages were just installed by apt. Is there a more elegant way to do things than capturing a list in the PRE hook and then recapturing and checking for changes in the POST hook?
3. Is there a more elegant approach that I have not considered?
Asked by zpangwin
(1061 rep)
Sep 2, 2020, 09:16 PM
Last activity: Mar 24, 2021, 02:16 PM
Last activity: Mar 24, 2021, 02:16 PM