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!

Run Postinit/Shutdown command in jail at boot.

Jails with XigmaNAS
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Run Postinit/Shutdown command in jail at boot.

Post by Babovand »

Hello

I've not been able to figure out have to make my jail run simple commands at boot (postinit) like in Nas4Free webGui.
For example, rtorrent does not come with a rc.d script, and the program needs to be attached to another shell window like screen and tmux.

How to auto run commands each time you start/restart the jail?

Snunn1
Starter
Starter
Posts: 35
Joined: 05 Sep 2013 21:55
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by Snunn1 »

Add the following to your rc.conf.local for the jails i.e. /jail/rc.conf.local, changing the <JAILNAME> to the name of your jail and adding your startup/shutdown commands between the speechmarks:

Code: Select all

jail_<JAILNAME>_exec_start="ENTER STARTUP COMMAND HERE"
jail_<JAILNAME>_exec_stop="ENTER SHUTDOWN COMMAND HERE"
Hope this Helps
Snunn1
NAS4Free 10.2.0.2.2545 P14 Embedded on 1GB USB Key
HP N40L Microserver - 8GB ECC RAM, 3x Seagate 500GB RAIDZ1, 1x Seagate 500GB UFS & 1x 200GB SATA
Extensions: RRDGraphs

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by Babovand »

Snunn1 wrote:Add the following to your rc.conf.local for the jails i.e. /jail/rc.conf.local, changing the <JAILNAME> to the name of your jail and adding your startup/shutdown commands between the speechmarks:
Snunn1
I cannot find rc.conf.local in /etc/ inside my jail, or anywhere else for that matter. where should it be? inside finch chroot or inside jail? i cant find it inside finch chroot

Snunn1
Starter
Starter
Posts: 35
Joined: 05 Sep 2013 21:55
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by Snunn1 »

Babovand wrote:I cannot find rc.conf.local in /etc/ inside my jail, or anywhere else for that matter. where should it be? inside finch chroot or inside jail? i cant find it inside finch chroot
Your original post didn't mention Finch so I thought you might have been using TheBrig or the Wiki method. I'm not too familiar with Finch, you'd be better asking dreamcat4 how to do it.

Regards
Snunn1
NAS4Free 10.2.0.2.2545 P14 Embedded on 1GB USB Key
HP N40L Microserver - 8GB ECC RAM, 3x Seagate 500GB RAIDZ1, 1x Seagate 500GB UFS & 1x 200GB SATA
Extensions: RRDGraphs

Snunn1
Starter
Starter
Posts: 35
Joined: 05 Sep 2013 21:55
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by Snunn1 »

On my system using the Wiki method, my rc.conf.local is in /jail/conf on the host.
NAS4Free 10.2.0.2.2545 P14 Embedded on 1GB USB Key
HP N40L Microserver - 8GB ECC RAM, 3x Seagate 500GB RAIDZ1, 1x Seagate 500GB UFS & 1x 200GB SATA
Extensions: RRDGraphs

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by dreamcat4 »

The best thing to do is type "man rc" and read the official FreeBSD manpages. They explain everything about system startup.

It is the script "/etc/rc" and "etc/shutdown" which start everything up. The reason why rc.local file does not exist is because it is always like that on the official FreeBSD distribution.

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: Run Postinit/Shutdown command in jail at boot.

Post by dreamcat4 »


Post Reply

Return to “Jails”