Lenovo SA120 Fan Control


Recommended Posts

Good Morning!

 

I just wanted to share my script that uses the CA User Scripts Plugin to run a docker container that can change the speed of the Lenovo SA120 DAS.

 

https://github.com/ShoGinn/lenovo_fanspeed

 

This is a simple script that when running in the foreground will allow you to specify the speed between 1 and 7

 

Why??

 

Loading the SG3 utils and other general overhead is not something I want to do ;)

 

Spinning up a docker container is easy!

  • Like 1
Link to comment

Starting dockers from a script isn't the way it's usually done in Unraid. We have a user interface that allows you to fill in all the parts of the docker run command using a web form. In addition to making it easy to run the docker, that same web form saves the entries to make it very easy to start the docker again, reinstall the docker, or even edit the entries to change the docker run command. You can even specify an icon and other things for the container so it all integrates very well into the Unraid webUI.

Link to comment

@trurl

Peace on that, running a docker container via Unraid is very easy, but my intent here is to make a utility script with a purpose.

 

This is a throw away container that is 45mb in size that prevents installation of multiple pre-reqs.

 

Making it part of the CA User Script Plugin allows for one argument to be inputed and the container is spun up, and removed never leaving a trace (but it does leave the orphaned image to be used later).

 

I do have a TODO on this, and that is to see if I can make sure that Docker is running before this script can be run.

Completed the TODO and it now checks if Docker is enabled.

Edited by ShoGinn
fixed the TODO
Link to comment
  • 1 year later...
  • 4 months later...

Then if you are super nerdy, you can do the user script:

 

#!/bin/bash
#description=Starts a docker container to set the lenovo fan speed
#argumentDescription=Fan speed from 1-7
#argumentDefault=1
if grep -xq DOCKER_ENABLED=\"yes\" /boot/config/docker.cfg
then
	echo "Spinning up the container to set the fan speed at:" $1
	echo "This may take a awhile"
	docker run \
	--rm \
	$(for dev in /dev/sg*; do echo -n "--device $dev:$dev "; done) \
	shoginn/docker-lenovo-fancontrol:latest \
	./fancontrol.py $1
else
	echo "Enable Docker to use this script"
fi

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.