Run a script at boot


Recommended Posts

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.

Link to comment
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.

Link to comment
  • 5 years later...

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

 

 

  • Like 1
Link to comment
  • 11 months later...
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! :D


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 by cholzer
Link to comment
  • 4 months later...

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 by CleverestEU
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.