pman Posted March 9, 2017 Share Posted March 9, 2017 I would like to execute a python script every time the server boots. How can I achieve this? Thanks Quote Link to comment
trurl Posted March 9, 2017 Share Posted March 9, 2017 Nerd Tools plugin to install python. User Scripts plugin to schedule your script for boot. 2 Quote Link to comment
pman Posted March 10, 2017 Author Share Posted March 10, 2017 I have python installed and the script works manually. I installed the user scripts plugin. I see an option to run script at "Array Start" but not at system boot. Is it safe to assume array start will happen at system boot? I just installed unraid right before making this thread, so I am not very familiar with it yet. Thanks. Quote Link to comment
Squid Posted March 10, 2017 Share Posted March 10, 2017 Array Start happens whenever the array is started. IE: will happen late in the boot process and and every stop / restart of the array. 1 Quote Link to comment
pman Posted March 10, 2017 Author Share Posted March 10, 2017 Just now, Squid said: Array Start happens whenever the array is started. IE: will happen late in the boot process and and every stop / restart of the array. So would you go with array start, or is there a better way to run script at boot? Thank you. Quote Link to comment
Squid Posted March 10, 2017 Share Posted March 10, 2017 Array start means that all plugins, etc are installed, so that would be the best. An alternative to only run at boot is to manually add the command to the /boot/config/go file 1 2 Quote Link to comment
pman Posted March 10, 2017 Author Share Posted March 10, 2017 1 minute ago, Squid said: Array start means that all plugins, etc are installed, so that would be the best. An alternative to only run at boot is to manually add the command to the /boot/config/go file Thanks! Quote Link to comment
whoDat Posted June 1, 2022 Share Posted June 1, 2022 I needed ctrl-alt-del disabled on Unraid as well. Kept trying to login to my VM using it, without first remembering to bind the keyboard to the VM. Which would of course reboot the Unraid host instead. What I added to /boot/config/go -> # Disable ctrl-alt-del on Unraid host sed -i 's/ca::ctrlaltdel/# ca::ctrlaltdel/' /etc/inittab /sbin/telinit q 1 Quote Link to comment
cholzer Posted May 17, 2023 Share Posted May 17, 2023 (edited) On 3/10/2017 at 4:08 PM, Squid said: An alternative to only run at boot is to manually add the command to the /boot/config/go file I am very sorry to necro this old thread but I could really need help with this. I want promtail to launch at boot so that it can start to send logs to my log collection server. For this I added the following to /boot/config/go cp /boot/tools/promtail/promtail /usr/local/bin/promtail chmod +x /usr/local/bin/promtail /usr/local/bin/promtail -config.file /boot/tools/promtail/promtail-local-config.yaml /usr/local/bin/promtail -config.file /etc/promtail/promtail-local-config.yaml Result: promtail starts at boot and starts to send logs! Problem: on the monitor connected to the unraid machine I now see the promtail output - I nolonger have access to the unraid GUI Is there a way to start promtail "in the background?" inside the go file? I could I could use the userscript plugin, but then I can only start the script when the array starts - should the array fail to start or anything else bad happens then I dont get logs of that. So I would really like to launch promtail on boot. I tried to launch it with nohup but that did not solve it Edited May 17, 2023 by cholzer Quote Link to comment
itimpi Posted May 17, 2023 Share Posted May 17, 2023 2 hours ago, cholzer said: Is there a way to start promtail "in the background?" inside the go file? Have you tried adding an & to the end of the command (as is used when launching emhttp in the background from the go file). Quote Link to comment
cholzer Posted May 17, 2023 Share Posted May 17, 2023 1 hour ago, itimpi said: Have you tried adding an & to the end of the command thank you for the suggestion! sadly that does not work, promtail still takes control over what is displayed on the unraid machine's monitor. Quote Link to comment
CleverestEU Posted October 11, 2023 Share Posted October 11, 2023 (edited) No personal experience with promtail, but ... have you tried redirecting the STDOUT / STDERR to somewhere? /usr/local/bin/promtail -config.file /etc/promtail/promtail-local-config.yaml > /dev/null 2> &1 Above example will (attempt to) redirect STDOUT to /dev/null (i.e. "oblivion") and STDERR to "follow the footsteps STDOUT is going". Of course, the script / app can try to forcibly write stuff on terminal, but doing that is generally avoided to maximize compatibility; it is completely possible that there actually might be no terminal - it can be a true figment of script's imagination the user might actually know better where to put any kind of output (personally I might just target STDERR to something like /dev/tcp/errorlogginghost/666 or ... whatever etc. Edited October 11, 2023 by CleverestEU Quote Link to comment
Recommended Posts
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.