What is the preferred method to add a systemd service since updates delete a .service file in /etc/systemd/system? Is there a preferred location for the binary? I see that /usr/local/bin is read-only so?
There isn’t one. TrueNAS is an appliance OS; you aren’t expected to be adding stuff to it.
You could always enable dev mode - there are plenty enough warning about it on the resource page:
But even with dev mode enabled, wouldn’t /etc still be rebuilt on boot?
Donno - but should give OP the options to mess around as they see fit if they feel the risks are worth it. At worst a post-init?
In my case since there is no fan control built in I am forced to add it. Without it my fans cycle between full speed and off, multiple times per minute.
No chance there are any controls in the BIOS or IPMI?
My Supermicro BIOS has no such controls that I’ve found.
Any chance the following guide is of use? I’m fairly certain ipmitool is still included in TrueNAS
(if it is useful to you, expect that it gets removed on the next major update, because that seems to be the flavour of the last few releases)
Edit:
Might also be of use.
Part of my issue is I need to monitor my Nvidia GPU temp to control mobo fan PWM. I had to remove the GPU built-in fans. So mobo IPMI can’t handle the entire situation. I use IPMI control for CPU fan speed, but nvidia-smi for the rest of the fans. Chatgpt helped write a python script that I start with systemd.
To me it’d sound easier to wire the fans to the GPU pcb than trust chatgpt with whatever script. Or even just find a static fan speed that’d keep the GPU within acceptable thresholds while balancing noise.
I wish you luck - this is outside of my scope.
It has been a while since I’ve used developer mode but I can say that I have done things and everything stayed where it belongs even after reboot.
I have also just changed the file system to RW, did a few changes, restore the file system to RO, and the magic was done.
The key word here is “updates”. There is nothing you can do in /etc/ and expect it to survive an update. If you can place your files in /home/??? then those files will survive.
I’m not sure what you want to do with smartd exactly, but you could manually start it using the Init Script section and just run the command smartd.
That gets it running, but you need a smartd.conf file as well. I don’t know if there is a variable that is supported in Debian, worth looking at, and if you cannot change the location of the config file, then have a script check if the file exists, if not then make the file system RW, copy the file over, change the file system back to RO. I do that in Multi-Report when I would replace smartmontools with a newer version.
@joeschmuck - The ask was for SystemD, not SMART.
But, the use of a non-OS file system and a Post-Init script will probably work just fine.
Well you know where my mind has been. Thanks for the correction.
Starting this with a post-init or cron entry seems more sensible given the nature of this appliance OS.
Suggesting systemd strikes me as a perfect example of the chat robot not having any understanding, simply regurgitating grammatically okay text that appears to go together often.
GPT didn’t suggest systemd. I added it to systemd after GPT helped create the python script. Since then I deleted the systemd service and just added the script to the init from the GUI. Problem solved.
Thanx for the suggestions