Page 1 of 1
Run Postinit/Shutdown command in jail at boot.
Posted: 15 Jan 2015 21:07
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?
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 16 Jan 2015 21:41
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
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 17 Jan 2015 00:19
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
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 17 Jan 2015 00:24
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
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 17 Jan 2015 00:24
by Snunn1
On my system using the Wiki method, my rc.conf.local is in /jail/conf on the host.
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 17 Jan 2015 11:04
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.
Re: Run Postinit/Shutdown command in jail at boot.
Posted: 17 Jan 2015 11:06
by dreamcat4