Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
Last active October 29, 2024 20:13
Show Gist options
  • Save eatnumber1/218f36f669a3619feae71a80e2ed284c to your computer and use it in GitHub Desktop.
Save eatnumber1/218f36f669a3619feae71a80e2ed284c to your computer and use it in GitHub Desktop.
Systemd units needed to hook up my Supermicro JBOD to my machine's boot process.
[Unit]
Description=Power control for %i
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
Requires=network-online.target
After=network-online.target
PartOf=%i.target
Before=%i.target
Requires=local-fs.target
After=local-fs.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/sbin/ipmi-power --hostname=%i.local --on --wait-until-on
ExecStartPost=-/usr/bin/udevadm trigger --action=add --subsystem-match=scsi
ExecStartPost=-/usr/bin/udevadm settle
ExecStop=/usr/sbin/ipmi-power --hostname=%i.local --off --wait-until-off
ExecStopPost=-/usr/bin/udevadm trigger --action=remove --subsystem-match=scsi
[Unit]
Description=Set fan speed to minimum on jbod60
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
Requires=network-online.target
After=network-online.target
Requires=local-fs.target
After=local-fs.target
[email protected]
[email protected]
[Service]
Type=oneshot
RemainAfterExit=true
# Wait for a fan sensor to become available
ExecStartPre=/bin/bash -c 'while true; do s="$(/usr/sbin/ipmi-sensors --hostname=jbod60.local --sensor-types=fan --no-header-output --ignore-not-available-sensors)" || exit 1; [[ -n "$s" ]] && break; sleep 2s; done'
# netFn 30 is fan commands.
# cmd 45 controls the fan setting
# subcommand 01 sets the current fan setting
# the last arg determins which fan setting to set to
#
# the fan modes are:
# standard: 0
# full: 1
# optimal: 2
# heavy_io: 4
#
# Set the fan mode to full
# doesn't seem to work in quick succession with setting the speed. set in web ui
#ExecStart=/usr/sbin/ipmi-raw -h jbod60.local 0 30 45 01 01
# We can set the percent duty cycle with Cmd 70
# The usage is:
# ipmi raw 30 70 66 01 <zone> <duty_cycle>
# Note: We don't know what 66 means.
# Note: 66 00 is to read
# Note: 66 01 is to write
#
# The zones are 00 or 01. On jbod60, 00 seems to control all the fans.
# The duty cycle is 00 to FF (min to max).
ExecStart=/usr/sbin/ipmi-raw --hostname=jbod60.local 0 30 70 66 01 00 01
# On a restart, the first command doesn't seem to work. Not sure why.
ExecStart=/usr/sbin/ipmi-raw --hostname=jbod60.local 0 30 70 66 01 00 01
# Set the fan mode to standard
#ExecStop=/usr/sbin/ipmi-raw -h jbod60.local 0 30 45 01 02
[Install]
WantedBy=sysinit.target
[Unit]
Description=jbod60 is ready
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
# There are two controllers, both reachable over the two ports. The wwn refers
# to the controllers, not the ports.
After=sys-subsystem-scsi-wwn-naa.5003048029ee68bd.device sys-subsystem-scsi-wwn-naa.5003048029ee693d.device
BindsTo=sys-subsystem-scsi-wwn-naa.5003048029ee68bd.device sys-subsystem-scsi-wwn-naa.5003048029ee693d.device
[email protected]
[email protected]
Before=remote-fs-pre.target
Wants=remote-fs-pre.target
[Install]
WantedBy=sysinit.target 12:50:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment