This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

start renderfarm as postinit script fails

Jails with XigmaNAS
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

start renderfarm as postinit script fails

Post by maddes »

Hi, i finally managed to get my setup of a small renderfarm for blender running.

It took some time, since i run the master and one slave in a jail inside my nas4free-box without the gui, and for somekofiguration i missed the feedback of the gui to find out what was going wrong.

But now it works, i have a super compact script to start my two blenderinstances in background, and it works when I run it from the console.

Code: Select all

#!/bin/bash
echo Renderfarm Master startet
jexec 3  blender -b /usr/blender/master-213.blend --addons netrender -a &
echo Renderfarm slave startet
jexec 3 blender -b /usr/blender/slave-213.blend --addons netrender -a &
Now I want to have it run at system start and included my script in
System|Advanced|Command scripts

The script gets executed and echoes the messages, but blender is not running.
the jails are already running when the script gets executed.
Does anybody have a hint how to get it work at system startup?

maddes

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: start renderfarm as postinit script fails

Post by fsbruva »

How many jails do you have?

maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

Re: start renderfarm as postinit script fails

Post by maddes »

I have 3 Jails, but the blender-jail is the only one that i want to run at startup.
The first is the proto-jail, the second one for playing araund with it. Maybe i should remove them from autostart. They may be startet at need.
But I would like to have the renderfarming functionality from startup.

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: start renderfarm as postinit script fails

Post by fsbruva »

The JID gets incremented each time you start a jail. Upon reboot, there is no way to reliably assume what the JID for a particular jail is. Further, the "name" property of jails has been deprecated, and won't be supported much longer.

The best way would be to obtain the JID on your N4F host by checking out the contents of your jail_{name}.id file. This file gets created as part of your jail startup, and contains the JID of the jail.

EDIT: The file is located at /var/run/jail_{name}.id

maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

Re: start renderfarm as postinit script fails

Post by maddes »

For me the 3 jails always start in the same order and #3 always is the blender jail.
The problem is not the jail number.
I can run the script after systemstart and it works.

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: start renderfarm as postinit script fails

Post by fsbruva »

Well, but the jexec is obviously not doing what you think. Just because it's echoing doesn't mean it's successfully starting the process. And, to make your startup script tolerant to adding or removing the autostart of jails, using the .id file would be wise (but that's my $0.02).

Do you have your script running as a postinit task? How do you know that the jails are started? I also doubt that the command will work from the commandline and not as a startup script. When you run jexec, the first thing after the JID, (in your case blender) is the command that is run, but then I think everything else is considered a parameter to jexec, not a parameter to your command. Why not just have an rc script that starts them upon jail startup? You can make each jail execute a script once it starts.

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: start renderfarm as postinit script fails

Post by fsbruva »

FWIW:

Code: Select all

ID = `cat /var/run/jail_proto.id`
jexec $ID /usr/sbin/blenderstart.sh

maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

Re: start renderfarm as postinit script fails

Post by maddes »

Again, it's not a problem with the ID. I will use this line te evaluate the id to make it mor reliable.
But the script works when run from a console.
It does not work as postinit script.
Somehow its a problem with detaching with & at the end of th line (which is necessary as it keeps running and will prvent to execute the second line of the script with the slave and any sucessing steps in the system start)
When I omit the & then it "works" as expected: Blender starts and sends output to the console, but i have to ^C stop it to get the otehr blender instance running, and again I have to ^C stop it to get the last lines of startup and the Menu.
And so far noone can help with this issue.

maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

Re: start renderfarm as postinit script fails

Post by maddes »

Finaly recognized this thread:
viewtopic.php?f=79&t=1575&start=20
:oops:
I removed the script from System|Advanced|Command scripts
and changed it to run inside the jail:

Code: Select all

#!/bin/sh
echo Renderfarm Master startet
blender -b /usr/blender/master-213.blend --addons netrender -a &
echo Renderfarm slave startet
blender -b /usr/blender/slave-213.blend --addons netrender -a &
and added a line in /etc/rc.conf.local

jail_blender_exec_start="/usr/blender/renderfarm.sh"

and this seems to work
:D

maddes
NewUser
NewUser
Posts: 10
Joined: 23 Oct 2012 22:32
Status: Offline

Re: start renderfarm as postinit script fails

Post by maddes »

fsbruva wrote:The JID gets incremented each time you start a jail. Upon reboot, there is no way to reliably assume what the JID for a particular jail is. Further, the "name" property of jails has been deprecated, and won't be supported much longer.
Now I don't need this anymore, but on my system, the JID always starts at 1.
when i stop the jails and restart, the JID gets incremented further, but at system start it begins at 1 again.
Is this different on other systems?
:?

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: start renderfarm as postinit script fails

Post by fsbruva »

I am glad you got it figured out. Just to clarify - the jail startup runs renderfarm.sh. Does that only start blender? If so, this is a poor configuration choice. It would be better to have renderfarm.sh call "/bin/sh /etc/rc" first, and then start blender. This way you know everything in the jail has been started properly.

As for JID, upon reboot, yes, the JID starts at 1. But not everyone starts all of their jails at boot, and the order of jail startup is determined by their listing order within the rc.conf (or rc.conf.local, in our case). However, if a jail takes too long to start, a race condition can emerge where the second one to start is actually given JID 1. Also, with the understanding that all things eventually change - making the JID references resilient means it's ONE LESS THING TO CHANGE LATER. As long as the jail's hostname remains the same, then using the .id file will work flawlessly. Also, sometimes a software install in the jail requires a "reboot." This doesn't require the N4F host to be rebooted - you can just restart the jail. In that case, you probably want the jail to start properly.

Post Reply

Return to “Jails”