If you add a ampersand sign to the end of any command you send it to the background.
To bring it back to the foreground you can use
fg
command.
For Example:
/usr/local/bin/hass --open-ui --config /mnt/hass &
But that won't really help if the shell is closed. There are couple of programs that can help with this.
I personally use program called
screen
you can install it like any normal freebsd package in the jail.
After you have screen installed run the command like this:
screen -d -m /usr/local/bin/hass --open-ui --config /mnt/hass
This will run the command (-m) in screen in detached (-d) mode.
To list running screen sessions run:
screen -ls
To reattach one of those sessions run:
screen -r <process id number that screen -ls command shows>
More info on screen:
https://linuxize.com/post/how-to-use-linux-screen/
One more thing, I see that hass has daemon mode (same mode i run my flexget instance above), so you can skip the installing screen and run command like this:
/usr/local/bin/hass --open-ui --config /mnt/hass --daemon
For your startup script you can try this startup script:
Code:
#!/bin/sh
. /etc/rc.subr
name=hassd
rcvar=hassd_enable
start_cmd="${name}_start"
stop_cmd=":"
load_rc_config $name
hassd_start()
{
/usr/local/bin/hass --open-ui --config /mnt/hass --daemon
}
run_rc_command "$1"
1) Make a file named
hassd
in
/etc/rc.d
directory and add the script above
2) Now you edit
/etc/rc.conf
and add
hassd_enable="YES"
line to the file.
3) Restart the jail