Ubuntu – How to get a byobu session with a command to run on startup

byobu

I am trying to get Byobu to startup with Ubuntu Server 12.04 when the server starts up.

I've figured out how to do this with a screen session but I want it to be in Byobu with all the added features, not in screen.

in start() within an init.d script for screen this is the line that works (after changing the environment to the correct user via su - $USER -c "$USER_INIT; $1" >/dev/null && return 0 — USER and USER_INIT are both populated properly, tested working via screen):

screen -U -S $SESSIONNAME -d -t $WCAPP -m $WCAPP

replacing screen with byobu or byobu-screen does not work. I have the back-end set to screen.

I DO NOT want to edit the /.byobu/windows file as that does not launch until a user manually starts a byobu back-end.

The $SESSIONNAME I am using is weechat and the $WCAPP variable is weechat-curses, I have no quarrels about using the literal value instead of passing variables.

Thank you.

Best Answer

Open your terminal(CTRL+ALT+T) and then type as

nano /etc/rc.local

and then add this line before exit 0

byobu -S boot-time mycommand &

Then press ctrlx save & close.

Related Question