1

I have installed the VMWare Tools into a test Ubuntu guest, and it's created the standard scripts as expected:

poweroff-vm-default
poweron-vm-default
resume-vm-default
suspend-vm-default

I add some custom actions to the scripts, but it says in the top of the file

##########################################################################
# DO NOT modify this file directly as it will be overwritten the next
# time the VMware Tools are installed.
##########################################################################

So where should the custom scripts go, if I'm not supposed to modify these ones?

scriptsdir="`dirname $0`/scripts/`basename $0`.d"
if [ -d "$scriptsdir" ]; then
    for scriptfile in "$scriptsdir"/*; do
        [ -x "$scriptfile" ] && "$scriptfile" poweron-vm
    done
fi
Cylindric
  • 1,107
  • 5
  • 24
  • 44

2 Answers2

2

Here is some information on creating custom VMWare Tools scripts.

From phrases such as "enter the path and name of the script file" and "use the Browse feature to navigate to and select the new custom script" I infer that any location is suitable. I would use /usr/local/bin.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
  • Not very helpful – user705142 Jul 16 '12 at 01:12
  • @user705142: The OP apparently found it useful since he accepted it. However, I've tried to improve my answer a little. You didn't say how you found it unhelpful, but I hope you find the change at least a slight improvement. And yet someone upvoted it just after you made your comment and before I edited it. – Dennis Williamson Jul 16 '12 at 01:52
  • If you're adding in scripts manually like this guy's doing they need to be in simple subdirectories such as /script/resume-vm-default.d/. Your link is only helpful if using the GUI, which this guy isn't (nor me, who came across this via google). – user705142 Jul 16 '12 at 06:37
2

They go in (ToolsDir)/script/resume-vm-default.d/, (ToolsDir)/script/poweroff-vm-default.d/ directories.

They also need to be executable.

user705142
  • 433
  • 6
  • 16