I have seen lot of answers on this nothing seemed to work on my system (probably I did mistake)
I have dkms module of wifi installed which does not reload itself when I resume from suspend. So i need to run these commonds in terminal as root
modprobe -r "wifi driver"
modprobe -i "wifi driver"
I am new to linux and all that script stuff so i need in detail.
What exactly I need is how to make script (which will run the above commands as root
) and what changes I need to make in this (as I want to run script when i resume from suspend).
[Unit]
Description=Some description
Before=sleep.target
StopWhenUnneeded=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStop=-/path/to/your/script.sh
[Install]
WantedBy=sleep.target
https://askubuntu.com/a/1041358/856436
If anyone knows any other ways to automatically reload a dkms kernel module please add as answer.
My System: Ubuntu 18.04 LTS with kernel 4.20.3-042003-generic
man pm-action
- it explains the scripts that are run at Suspend/Resume/Sleep/Wake times. – waltinator Jan 19 '19 at 15:01