0

Trying to run

#!/bin/sh
# byobu_launcher.sh ver 20170915122301 Copyright 2017 alexx, MIT Licence ver 1.0

byobu new-session -d -s $USER

# mongod
byobu new-window -t $USER:1 -n 'MLT'
byobu send-keys "/home/username/scripts/mlt.sh" C-m

I'm using this template with the correct info put in

.

[Unit] Description=byobu

[Service] ExecStart=/root/scripts/byobu.sh Restart=always

[Install] WantedBy=multi-user.target

After starting the service I get this error

Apr 30 14:36:29 ubuntu byobu.sh[4141]: Cannot run byobu because [] does not own []
Apr 30 14:36:29 ubuntu byobu.sh[4141]: Cannot run byobu because [] does not own []
Apr 30 14:36:29 ubuntu byobu.sh[4141]: Cannot run byobu because [] does not own []

Not sure how to fix or change the ownership.

Strangely it works on rc.local, but I think getting it to work on Systemd would be better.

0

2 Answers 2

0

You are using the $USER variable but systemd has not set it. It only set when you use the User= directive.

If you want to run your service as root, then you would add User=root to your [Service] section.

Related documentation for this in Environment Variables in Spawned Processes in the systemd.exec man page.

2
  • Thanks so much. I needed to add your part and another variable called
    – snickerpop
    Commented May 1, 2018 at 15:48
  • Thanks so much. I needed to add your part and another variable called. RemainAfterExit=yes. The code works with what I have below.
    – snickerpop
    Commented May 1, 2018 at 15:56
0

This code works now

[Unit] Description=MFC Byobu After=network.target

[Service] ExecStart=/root/scripts/byobu.sh User=root Restart=always RemainAfterExit=yes

[Install] WantedBy=multi-user.target

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .