Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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.