LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   modprobe/rmmod on application startup/exit (http://www.linuxquestions.org/questions/slackware-14/modprobe-rmmod-on-application-startup-exit-4175481543/)

narz 10-21-2013 12:13 AM

modprobe/rmmod on application startup/exit
 
Sup. This seems like something very simple to do that I should already know but I've never done it before. Basically when running VMWare Player, I want to auto modprobe vmmon, vmci, vmnet when starting it and rmmod them when I exit.

How do I do this? Thanks. :)

pan64 10-21-2013 02:34 AM

https://www.linuxquestions.org/quest...n-boot-199457/

unSpawn 10-21-2013 02:43 AM

...or you could move the script or binary that starts VMWare Player to another name then encapsulate the commands in a script:
Code:

#!/bin/bash --
_svc() {
  case "$1" in
  start) ACTION=modprobe;;
    stop) ACTION=modprobe;;
      *) exit 1;;
  esac

for LKM in vmmon vmci vmnet; do
 $ACTION $LKM || exit 1
done
 } # End of _svc

_svc start
/path/to/vmwareplayer
_svc stop

exit 0


narz 10-21-2013 04:01 AM

Quote:

Originally Posted by unSpawn (Post 5049463)
...or you could move the script or binary that starts VMWare Player to another name then encapsulate the commands in a script:
Code:

#!/bin/bash --
_svc() {
  case "$1" in
  start) ACTION=modprobe;;
    stop) ACTION=modprobe;;
      *) exit 1;;
  esac

for LKM in vmmon vmci vmnet; do
 $ACTION $LKM || exit 1
done
 } # End of _svc

_svc start
/path/to/vmwareplayer
_svc stop

exit 0


Interesting. I might give this a shot later. Thanks.

Didier Spaier 10-21-2013 04:52 AM

I do it that way:
  1. At end of /etc/rc.d/rc.local, add following lines:
    # Modules needed by vmplayer
    modprobe vmmon
    modprobe vmci
  2. type this as root:
    chmod +x /etc/rc.d/rc.{local,sysvinit}
After booting, vmplayer is ready.

rc.sysvinit should be executable because that's what vmplayer uses.

PS doing things that way modules are not unloaded when you quit vmplayer, but if you are short enough in RAM to care for that, you don't have enough RAM to run vmplayer anyway, so that doesn't hurt at all ;)


All times are GMT -5. The time now is 05:23 AM.