How to restart Teamviewer daemon programmatically?

I've installed TV as a server on a Ubuntu 12.04 box running 24/7. Unfortunately, the daemon service sometimes bugs and disconnects. I can fix this at the terminal with :

sudo teamviewer --daemon <stop/start>

But this requires local access to the server, which is not always possible. I could make a script to periodically check (start and stop) the service,

But I do not know how to issue a sudo command within the script. Can anyone help? Thanks!


Solution 1:

Probably you don't need a script but a cron job that runs the command. Type sudo crontab -e, then append the following:

0 * * * * service teamviewerd restart

This will run the command each hour sharp, so you may want to modify it or be pending because you will be disconnected. You may also want to know why teamviewer disconnects, so a peek to the logfiles and a bug report may be necessary.

Solution 2:

Trying “sudo teamviewer –daemon start” doesn’t actually do anything for me(Linux Mint) – so the solution is to:

sudo teamviewer --daemon enable

If the daemon service certainly stop working then this resolution start daemon again, TV is ready to use.

Found Solution over this page

Link to Another Solution