xenserver: Only require confirmation for "vswitch restart" if interactive.
authorBen Pfaff <blp@nicira.com>
Mon, 18 May 2009 22:29:45 +0000 (15:29 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 21 May 2009 19:48:39 +0000 (12:48 -0700)
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.

xenserver/etc_init.d_vswitch

index d537690224e5cc738304af043e946b1622883d9e..573fb695f72ad66fd3ce862fa4a46f1c47bceff1 100755 (executable)
@@ -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 <<EOF
 
 WARNING!!!