Debugging Byobu

Ubuntu ships with a neat GNU screen enhancement called byobu. One of the nice features is to run custom scripts. The output of your custom byobu scripts are shown in the status line of your byobu session.

Byobu runs custom commands

I’ve converted my former screen script to run as a custom script in byobu, but it suddenly stopped working. I was wondering why and found a way to see what the problem was.

What you need

My script scans my mail directory and checks for new mail. I placed it in my home directory under:

$ ls /home/roman/.byobu/bin
3_maildircheck

Debugging

The following points should give you a clue why your custom script won’t work with byobu:

  1. Check if you have enabled custom scripts in byobu (press F9 in a byobu session).
  2. Run the custom command by itself from the plugins directory, not from your home directory. The plugins directory is located under Ubuntu in /usr/lib/byobu/custom.
  3. The output of custom scripts are written to a cache file under /var/run/screen. Check what the cache files tell you.

2 thoughts on “Debugging Byobu

  1. Weird. I made a file in the ~/.byobu/bin directory named 5_sensors but it won’t show up…

    1. I have custom enabled

    2. running the custom command by itself:

    gavin@funkay:~/.byobu$ /usr/lib/byobu/custom
    gavin@funkay:~/.byobu$

    produces nothing on output or in status bar

    3. can’t see any sign of it’s cache under /var/run/screen either:

    gavin@funkay:~/.byobu$ ls -la /var/run/screen/S-gavin/
    total 20
    drwx—— 2 gavin gavin 180 2010-11-09 15:47 .
    drwxrwxr-x 3 root utmp 60 2010-11-08 17:05 ..
    prwx—— 1 gavin gavin 0 2010-11-09 15:47 30770.byobu
    -rw-r–r– 1 gavin gavin 8 2010-11-09 16:59 byobu.disk_read
    -rw-r–r– 1 gavin gavin 8 2010-11-09 16:59 byobu.disk_write
    -rw——- 1 gavin gavin 0 2010-11-08 17:30 byobu-exchange
    -rw-r–r– 1 gavin gavin 11 2010-11-09 16:59 byobu.network_down
    -rw-r–r– 1 gavin gavin 10 2010-11-09 16:59 byobu.network_up
    -rw-r–r– 1 gavin gavin 3 2010-11-09 07:56 byobu.updates-available

    Running y custom script does work standalone:

    gavin@funkay:~/.byobu$ bin/5_sensors
    72
    gavin@funkay:~/.byobu$

    Wondered if you had any other experience of debugging to share?

  2. I would try to put in some print debugging in the /usr/lib/byobu/custom script. Interesting would be, if the script picks your script up and executes it.

    Just a simple echo $VARIABLE usually leads the way. Let me know what you were able to find out 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s