Boot order/priority for VMs and Dockers


Recommended Posts

3 minutes ago, jonathanm said:

Weird. So if you type just the portion inside the double quotes, what happens?

/boot/config/plugins/user.scripts/scripts/StartVMs/script

This

root@xserver:~# /boot/config/plugins/user.scripts/scripts/StartVMs/script
-bash: /boot/config/plugins/user.scripts/scripts/StartVMs/script: No such file or directory
root@xserver:~# 

VERY WEIRD O_O

Link to comment

Also If I do 

root@xserver:~# cd /boot/config/plugins/user.scripts/scripts/StartVMs
-bash: cd: /boot/config/plugins/user.scripts/scripts/StartVMs: No such file or directory
root@xserver:~# 

I can get into scripts folder

root@xserver:~# cd /boot/config/plugins/user.scripts/scripts/
root@xserver:/boot/config/plugins/user.scripts/scripts# ls -la
total 56
drwxrwxrwx 7 root root 8192 Mar 20 12:59 ./
drwxrwxrwx 3 root root 8192 Mar 19 21:19 ../
drwxrwxrwx 2 root root 8192 Mar 20 12:59 StartVMs/
drwxrwxrwx 2 root root 8192 Mar 20 12:59 VMDelay/
drwxrwxrwx 2 root root 8192 Mar 19 21:14 delete.ds_store/
drwxrwxrwx 2 root root 8192 Mar 19 21:14 delete_dangling_images/
drwxrwxrwx 2 root root 8192 Mar 19 21:14 viewDockerLogSize/
root@xserver:/boot/config/plugins/user.scripts/scripts# 

But then I can't O_O

root@xserver:/boot/config/plugins/user.scripts/scripts# cd StartVMs
-bash: cd: StartVMs: No such file or directory
root@xserver:/boot/config/plugins/user.scripts/scripts# 

I can get inside VMDelay

root@xserver:/boot/config/plugins/user.scripts/scripts# ls
StartVMs/  VMDelay/  delete.ds_store/  delete_dangling_images/  viewDockerLogSize/
root@xserver:/boot/config/plugins/user.scripts/scripts# cd VMDelay/
root@xserver:/boot/config/plugins/user.scripts/scripts/VMDelay# ls -la
total 32
drwxrwxrwx 2 root root 8192 Mar 20 12:59 ./
drwxrwxrwx 7 root root 8192 Mar 20 12:59 ../
-rwxrwxrwx 1 root root    7 Mar 20 12:59 name*
-rwxrwxrwx 1 root root   85 Mar 20 12:59 script*
root@xserver:/boot/config/plugins/user.scripts/scripts/VMDelay# 

 

I will try to delete and add the script again

Edited by bluepr0
Link to comment
1 minute ago, bluepr0 said:

Will do a check for sure, something weird happened for sure.

The good thing to come out of all this is that you know how to set up scripts, and what they can and can't do on startup. It's pretty simple really, a script can be just a list of commands you could type at the command line, but don't particularly want to type over and over again manually. You can start dockers, VM's, do pretty much anything with a script.

  • Like 1
  • Upvote 1
Link to comment
  • 1 year later...

Are there any recommended changes to these scripts now that unraid no longer allows executing scripts off of the boot device? Basically all I'm getting now is the following error because you cannot execute a script from that location anymore. I'm not entirely sure if the array is fully available to put the script in my system share either.

sh: line 19: /boot/config/plugins/user.scripts/scripts/StartVMs/script: Permission denied

 

Link to comment
22 minutes ago, iarp said:

Are there any recommended changes to these scripts now that unraid no longer allows executing scripts off of the boot device? Basically all I'm getting now is the following error because you cannot execute a script from that location anymore. I'm not entirely sure if the array is fully available to put the script in my system share either.


sh: line 19: /boot/config/plugins/user.scripts/scripts/StartVMs/script: Permission denied

 

User scripts executes its scripts differently, so that error is basically impossible to happen, unless you're trying to execute that script from within another script of user scripts.

 

In that case you would change your script to execute it like

/bin/bash /boot/config/plugins/user.scripts/scripts/StartVMs/script

 

Link to comment
1 hour ago, iarp said:

On this comment he mentions it being two scripts, one that starts at array start which in turn starts the other script. I changed it to your command and it works when I run script on the initial script. Thanks.

The two script workaround may not be needed any more, I haven't bothered to investigate. A lot of things have changed in Unraid since that writeup.

Link to comment
On 1/10/2021 at 6:35 PM, jonathanm said:

The two script workaround may not be needed any more, I haven't bothered to investigate. A lot of things have changed in Unraid since that writeup.

What?

 

Can you please point us to the new simplest solution? TY!

 

 

In the meatime I share my customized solution.

 

I had to use NC installing netcat-openbsd-1.105 from Nerd Pack in order to be able to test a web server on a specific port.

 

My script is this now:

 

#!/bin/bash
printf "%s" "waiting for ZoneMinder ..."
# Change IP to match an address controlled by ZoneMinder.
# I recommend ZoneMinder internal gateway or some address guaranteed to be up when ZoneMinder is finished loading.
# I don't use external IP's because I want my internal network and appliances to be fully available
# whether the internet is actually connected or not.
while ! nc -vz 192.168.2.100 8088 &> /dev/null
do
    printf "%c" "."
done
printf "\n%s\n"  "ZoneMinder is back online"
sleep 10
virsh start Hass.io
# Insert optional delay to stagger VM starts
#sleep 30
#virsh start VMName2

 

I use it to start my Home Assistant VM after basics dockers are online (MQTT, DECONZ, MARIADB and ZONEMINDER)

Edited by Jokerigno
Link to comment
  • 1 month later...
On 1/10/2021 at 6:35 PM, jonathanm said:

The two script workaround may not be needed any more, I haven't bothered to investigate. A lot of things have changed in Unraid since that writeup.

@jonathanm @Squid @iarp

 

any feedback on how to do this now?

 

My StartVMs works but it's not trigged by Delay VM Start 

 

#!/bin/bash

echo "/boot/config/plugins/user.scripts/scripts/StartVMs/script" | at now

 

Thank you

 

 

Link to comment
  • 2 months later...
On 2/26/2021 at 11:31 AM, Jokerigno said:

@jonathanm @Squid @iarp

 

any feedback on how to do this now?

 

My StartVMs works but it's not trigged by Delay VM Start 

 


#!/bin/bash

echo "/boot/config/plugins/user.scripts/scripts/StartVMs/script" | at now

 

Thank you

 

 

I changed the line echo "/boot/config/plugins/user.scripts/scripts/StartVMs/script" | at now

to

/bin/bash /boot/config/plugins/user.scripts/scripts/StartVMs/script

 

So I can trigger the other script.

 

However be aware that you can use just the second script (the big one) with "At Startup of Array" option 

I hope I was able to assist.

 

All the best,

Lucas

 

  • Thanks 1
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.