Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I have a Linux Virtual Machine running on a VMWare ESXi Host. I need the OS to remount the CDROM when waking up from "Suspend" (In VMWare the machine ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2012
    Posts
    1

    Run Bash Script on Wakeup from Suspend


    Hi,

    I have a Linux Virtual Machine running on a VMWare ESXi Host. I need the OS to remount the CDROM when waking up from "Suspend" (In VMWare the machine is "Suspended", some things are changed and then "Powered On").

    I've tried multiple options, including adding a script to /etc/pm/sleep.d/ and adding an ACPI script for "wakeup" but none of these seem to work, the "Remount" script I'm running works fine if ran manually (and is simply a 2 line script compromising of u mount and mount).

    Does anyone have any suggestions as to what I can do to get this working? I'm running Ubuntu Linux and the version of the ESXi host is 4.1. Any suggestions would be greatly appreciated.

    Thanks.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,752
    There are probably as many way to do this as there are systems engineers out there. This one would start a bash script at boot that records the date+time, sleeps for a few seconds, then looks at the current date+time to see if more time than it slept for has expired since the date+time was recorded. If more than that time span (plus some factor to account for system activity that may have pre-empted it), has passed, then it can auto-remount the CD-ROM drive. I think that might work, but the umount would fail if something is accessing the drive, and I'm not sure if that were the case when the VM was suspended whether it would still be in a "busy" state. You might need to force the CD-ROM to be umounted (with the -f option to umount).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •