Script Automatisation on boot

Hi everyone

i recently created a minecraft server on a truenas jail, it works fine, but i would like my mincraft server to start automatically when my truenas starts.

I’ve tried several solutions (recommended by chatgpt as I’m not a truenas expert)
First, I tried calling the file that starts the server, startserver.sh, in the rc.local file, entering the path.

It didn’t work, I tried to create a scrpit in the rc.d folder and to call it in rc.conf, but it still didn’t work.

So I tried cron jobs in the truenas task menu, in the command section I entered the path to my .sh file, but again it didn’t work.

I then tried init/shutdow scrpits, where I could directly select my .sh file because I had the possibility to do so, and I thought it would work, but still nothing.

I’m running out of ideas so if anyone knows how to do it?
Thank you

You did these things

  • /etc/rc.local
  • /usr/local/etc/rc.d/somescript

inside your jail?

Because they are both supposed to work. But they need to be inside the jail.

If you want to use a cron job or an init script in TrueNAS you would need to perform some “magic” to have the actual command executed inside the jail.

Like

iocage exec <jailname> some-start-command.sh

and some-start-command.sh of course again has to be inside the jail!

P.S. This will install a turnkey Minecraft admin tool in a jail: