Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F63231007
/usr/local/sbin/suspend.sh
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
grahamperrin
Jun 23 2023, 6:47 PM
2023-06-23 18:47:38 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
/usr/local/sbin/suspend.sh
View Options
#!/bin/sh
# Save this script at a suitable path, for example
# /usr/local/sbin/suspend.sh
# then edit /etc/rc.suspend to include the path.
# Allow detachment of a USB device that is used for a ZFS pool named
# Transcend.
#
while
mount
|
grep
Transcend
2
>
&
1
;
do
zpool
export
Transcend
sleep
5
done
# – since <https://bugs.freebsd.org/253553> is fixed, I wonder whether
# combined use of sysutils/lsof lsof(8) and devel/libnotify notify-send(1) can
# notify the user of the path to an open file, if one is open within the pool.
# <https://www.freebsd.org/cgi/man.cgi?query=lsof&sektion=8&manpath=freebsd-ports>
# <https://www.freebsd.org/cgi/man.cgi?query=notify-send&sektion=1&manpath=freebsd-ports>
# Allow detachment of USB devices that are used for OpenZFS L2ARC for
# the boot pool on internal storage.
#
zpool
offline
august
gpt/cache-august
zpool
offline
august
gpt/cache2-august
zpool
offline
august
gpt/cache3-august
sync
killall
pulseaudio
# Credit to David Schlachter for 'USB audio devices on FreeBSD'
# <https://www.davidschlachter.com/misc/freebsd-usb-audio>
#
# Attempt to kill all dsp- and mixer-related processes.
#
while
fstat
|
grep
-e
dsp
-e
mixer
2
>
&
1
;
do
fstat
|
grep
-e
dsp
-e
mixer
|
cut
-w
-f
3
|
while
read
pid
;
do
kill
-15
"
$pid
"
done
done
# Make <IDT 92HD81B1X (Analog 2.0+HP/2.0)> (play/rec) the default
# on an HP EliteBook 8570p.
#
sysctl
hw.snd.default_unit
=
1
# Retrospective
# =============
#
# I found it impossible to kill PulseAudio. Instead, it was set to no longer
# automatically spawn: <https://forums.FreeBSD.org/posts/519408>.
#
# Killing of KMix by the script required a manual run of
# /usr/local/bin/kded5 &
# as grahamperrin after each wake of the computer.
#
# For a while, I forced deletion of KMix –
# <https://forums.FreeBSD.org/posts/524012> – and used a fake manifest to
# prevent automated reinstallation: <https://forums.FreeBSD.org/posts/528187>.
#
# Eventually, the issue involving KMix was resolved:
# <https://github.com/freebsd/freebsd-ports/commit/7dc8045a63930a3a520e17723139003867b58c39>
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6024887
Default Alt Text
/usr/local/sbin/suspend.sh (2 KB)
Attached To
Mode
P585 /usr/local/sbin/suspend.sh
Attached
Detach File
Event Timeline
Log In to Comment