0

I made a script to close teamviewer and reopen it every hour. I am now testing it every 5 seconds, but the loop is simply not working. The script is running correctly, but one time only.

I need your help.

#!/bin/bash
while :

do

echo "hello"

killall -9 TeamViewer.exe &> sample.s

sleep 1

killall -9  teamviwerd &> sample.s

sleep 5

teamviewer &> sample.s

sleep 5

done
amc
  • 7,022
  • 7
  • 39
  • 51
omar
  • 1
  • 1
    You can not kill teamviewer like this. teamviewer itself respawns when killed. You need to use the `stop` or `restart` option for the service. See http://askubuntu.com/questions/328519/why-teamviewer-keeps-running-in-the-background/328604#328604 – Rinzwind Nov 03 '13 at 16:17
  • - why do you need the sleep? (why not use `&&` and put them on 1 line?) -your 2nd killall has a typo in the name. – Rinzwind Nov 03 '13 at 16:25
  • 1
    also, you misspelled the process name in the second killall – enzotib Nov 03 '13 at 16:32

1 Answers1

0

Whatever is written in that loop....as long as there are no terminal errors the script should loop.

It seems though that the "done" on the last line is not executed. In that case you probably forgot to add a LF (i.e. Enter) to the last line.

thom
  • 7,372
  • 3
  • 24
  • 26