]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Log output from network script
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)
Log all output from the network script to help debugging.

open-vm-tools/scripts/linux/network

index 93a5a08afc862c61306574955c91e8565abc6ed2..cef9ec2823c35141913b007e5400d1c76240b1e2 100644 (file)
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/sh -x
 ##########################################################
-# Copyright (C) 2001-2016 VMware, Inc. All rights reserved.
+# Copyright (C) 2001-2017 VMware, Inc. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as published
 # of suspend and resume events, respectively.
 #
 
+logbase=/var/log/vmware-network
+logfile=$logbase.log
 
-echo `date` ": Executing '$0'"
+#
+# Rotate any logs
+#
+rotate_logfile() {
+    max=9
+    max=`expr $max - 1`
+    for s in `seq $max -1 1`; do
+        d=`expr $s + 1`
+        mv -f $logbase.$s.log $logbase.$d.log
+    done
+    mv -f $logbase.log $logbase.1.log
+}
+
+rotate_logfile
+
+# redirect stdio
+exec > $logfile 2>&1
+
+
+echo `date` ": Executing '$0 $*'"
 echo
 
 . `dirname "$0"`/../../statechange.subr
@@ -589,10 +610,13 @@ main() {
             exitCode=$?
          fi
          ;;
-      *) ;;
+      *)
+         echo "No argument supplied."
+         ;;
    esac
 
    return $exitCode
 }
 
 main "$@"
+echo `date` ": Finished '$0 $*'"