Why Teamviewer keeps running in the background?
Because that is the nature of teamviewer: it is build to respawn.
/opt/teamviewer8/tv_bin/script/teamviewerd.sysv
is probably responsible for it.
To stop teamviewer use:
sudo teamviewer --daemon stop
It will show ...
initctl stop teamviewerd
teamviewerd stop/waiting
and it is gone ...
rinzwind@discworld:/opt/teamviewer8/tv_bin/script$ ps -ef|grep teamviewer
rinzwind 12712 12428 0 18:11 pts/0 00:00:00 grep --color=auto teamviewer
Commands to manipulate the daemon:
teamviewer --daemon status show current status of the TeamViewer daemon
teamviewer --daemon start start TeamViewer daemon
teamviewer --daemon stop stop TeamViewer daemon
teamviewer --daemon restart stop/start TeamViewer daemon
teamviewer --daemon disable disable TeamViewer daemon - don't start daemon on system startup
teamviewer --daemon enable enable TeamViewer daemon - start daemon on system startup (default)
Regarding comment:
From teamviewer 9 help:
$teamviewer --help
TeamViewer 9.0.32150
teamviewer start TeamViewer user interface (if not running)
teamviewer --help print this help screen
teamviewer --version print version information
teamviewer --info print version, status, id
teamviewer --ziplog create a zip containing all teamviewer logs (useful when contacting support)
teamviewer --passwd [PASSWD] set a password (useful when installing remote (ssh)
teamviewer --daemon status show current status of the TeamViewer daemon
teamviewer --daemon start start TeamViewer daemon
teamviewer --daemon stop stop TeamViewer daemon
teamviewer --daemon restart stop/start TeamViewer daemon
teamviewer --daemon disable disable TeamViewer daemon - don't start daemon on system startup
teamviewer --daemon enable enable TeamViewer daemon - start daemon on system startup (default)
Options are still there in TV9.
If you install Teamviewer 10 from the .deb file, --daemon stop
as recommended above won't work in Ubuntu 14.04 LTS (and others?). Don't know why.
The daemon is an 'upstart' job, so it gets controlled from /etc/init/teamviewerd.conf
not /etc/init.d
.
Unfortunately, for me, both initctl stop teamviewerd
and service teamviewerd stop
result in:
initctl: Unknown instance:
teamviewerd.sysv
gets installed in /opt. So, to stop it, you need to do:
$ sudo /opt/teamviewer/tv_bin/script/teamviewerd.sysv stop
systemctl stop teamviewerd.service
systemctl disable teamviewerd.service
Here is the script "teamviewer.bash" I am using and that works in 14.04:
#!/bin/bash
# to be copied to /opt/teamviewer/tv_bin/script
# modify /usr/share/applications/teamviewer-teamviewer11.desktop :
# Exec=bash /opt/teamviewer/tv_bin/script/teamviewer.bash
# sudo visudo
# add:
# user ALL=(ALL:ALL) NOPASSWD:/opt/teamviewer/tv_bin/script/teamviewer
# sudo service sudo restart
echo 'teamviewer --daemon enable' | sudo sh && \
/opt/teamviewer/tv_bin/script/teamviewer && \
echo 'teamviewer --daemon disable' | sudo sh
teamviewer is using upstart to fire up the daemon at boot. The upstart does have a respawn set to keep a process running. As a 12.04 user mentioned, respawn stanzas in the upstart script are probably what you want to comment out.
The teamviewer process is/will run as root if fired up upstart. Since the respawn is in the upstart script you could have issues killing it permanently whether you do an implicit kill or 'sudo stop teamviwer' (the upstart way) or 'sudo teamviewer --daemon status'. Your best bet is probably just to comment out respawn lines in the upstart script, then start and stop as the service as needed.