I've made a basic script to run my Discord bot however, I can't get it to run on startup. I keep on getting an error saying. I'm using this Run bash script on startup and I still get an error " 'Run.sh' has missing LSB tags and overrides" Here is the script:

#! /bin/bash
#! /bin/sh

cd /media/root/NEW/ VOLUME/FurBot
node bot.js

I hope you can help :P


Unfortunately the Q&A you are consulting is

  • Mostly obsolete, since the accepted answer uses SysV init style methods instead of systemd ones. These are both init systems. The former is used on v. <= 7 Raspbian (unless I am remembering wrong, there's actually no < 7 since Raspbian follows Debian version numbering, and Debian has been evolving for a few decades). The latter is used on the previous (8, jessie) and current (9, stretch) versions. It supports SysV scripts for backward compatibility, but...

  • The accepted answer in that Q&A does not actually explain how to write a SysV style script, just how to enable one. And that's why you get the "missing LSB tags" error. The script is missing a lot of things that would make it SysV compliant.

There's no point in learning how to write such a script, however (it is a bit ornate), since the system is obsolete.

The easiest thing to do there would be to just add something to the end of /etc/rc.local (but before the final exit 0 line):

export PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin

cd /media/root/NEW\ VOLUME/FurBot
setsid node bot.js &> /dev/null

Notice I inverted the slash in NEW\ VOLUME. Command line parameters cannot have unescaped spaces in them; I presume that's what you mean to do. You can instead use quotes:

cd "/media/root/NEW VOLUME/FurBot"

setsid maybe spurious here but doesn't hurt. See man setsid for what it does.

If you want to get fancier, you can write a systemd service file for it -- you will find a lot of examples of such for node.js online -- but if this works for you, then don't worry about it.

  • What does the export PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin line do? Jan 6 '20 at 18:44
  • @PhillHealey en.wikipedia.org/wiki/PATH_(variable) Setting it explicitly in rc.local here might be a bit paranoid, but harmless.
    – goldilocks
    Jan 6 '20 at 19:00
  • Fair enough. I just like to know what every line of code does before I use it for anything. Jan 6 '20 at 19:05

There's an extra space in your #! line. And you only need one.

This should work better:


cd /media/root/NEW/ VOLUME/FurBot
node bot.js

The extra #! is treated as a comment so it wasn't breaking anything. But the extra space after the ! will break it.

  • 1
    Good catch but that's not the reason for that error message.
    – goldilocks
    Nov 11 '17 at 12:54
  • 1
    Oh there's also a space in the cd path, that should probably be NEW\ VOLUME.
    – goldilocks
    Nov 11 '17 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.