From: Ben Pfaff Date: Mon, 18 May 2009 22:29:45 +0000 (-0700) Subject: xenserver: Only require confirmation for "vswitch restart" if interactive. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e56c340e809a7618e02117de50969baa0a648285;p=openvswitch xenserver: Only require confirmation for "vswitch restart" if interactive. When /etc/init.d/vswitch restart is invoked non-interactively (e.g. from a cron job), don't require interactive confirmation. Not that we should encourage such behavior, but this approach seems closer to what most Unix utilities do in similar situations. --- diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index d5376902..573fb695 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -214,6 +214,10 @@ function stop_brcompatd { } function restart_approval { + if test ! -t 0; then + # Don't prompt if invoked non-interactively. + return 0 + fi cat <