Starting a Script at boot - In a Jail

Grinchy

Explorer
Joined
Aug 5, 2017
Messages
78
Hello,

I'm right now trying to get Narou.rb running in a FreeNAS Jail. Got it almost done, but i can't get it started on Bootup. Is there any way to start a Script in a Jail out of the FreeNAS UI?

To start the narou.rb Server, I need to switch the Folder to "/Novel" and use "narou web" to start the Web UI. Also "narou web" only works in the folder it was initialised in.
"/Novel/narou web" won't work. It says /Novel/narou wasn't found (it cuts the "web").


Tried it with adding "@Reboot /Novel/start.sh" and also directly "@Reboot cd /Novel/ && narou web" (without using the script) to the /etc/crontab file, but it won't start after restarting the Jail.

The start.sh Scrip (I don't really need the log, so it wouldn't be a problem without it):

Code:
#!/bin/bash
echo "Starting Server ..."
cd /Novel/ && narou web &>> /Novel/NarouServerLog.log &


Something that bothers me with this script is, that i can't get it started with ".start.sh". It only starts (and works) if I use "bash start.sh" directly. Is there something I did wrong with this?

I'm still quiet new with this stuff, so sorry if I missed something important.

Would be really great if someone knew how to get this working on startup.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is there any way to start a Script in a Jail out of the FreeNAS UI?
As @garm says, an rc script in the jail would be the "proper" way to do this. But you should be able to make it work through the GUI as well, in Tasks/Init/shutdown Scripts. Add it as a command, set it to post-init, and the command would be iocage exec jailname /path/to/script.
 
Top