Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.