1

I was having a hard time trying to make rc.local run on startup, which i still haven't achieved, and would appreciate any help with that.

The main problem right now is that I decided to follow this advice and accidentally deleted /etc/init.d/rc.local

I ran sudo apt-get install --reinstall initscripts, but it doesn't seem to restore restore it

Maybe any of you could give me a text copy of rc.local, or maybe a link to where I could download it, so I would just put it back there manually? I'm on Ubuntu 14.04

6
  • 1
    possible duplicate of How do I recover the default version of some configuration file?
    – muru
    Jul 5, 2015 at 15:04
  • wouldn't consider a duplicate, since, as I mentioned, use of dpkg -S and apt-get install --reinstall didn't solve anything
    – vch
    Jul 5, 2015 at 16:18
  • I don't suggest using --reinstall at all.
    – muru
    Jul 5, 2015 at 16:19
  • yes, but your file in that question was not provided by any packages, and rc.local is
    – vch
    Jul 5, 2015 at 16:22
  • What? O.o I provided two examples, one which is provided by a package and one which isn't.
    – muru
    Jul 5, 2015 at 16:23

1 Answer 1

0

Here you go:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          rc.local
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
    if [ -x /etc/rc.local ]; then
            [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
        /etc/rc.local
        ES=$?
        [ "$VERBOSE" != no ] && log_end_msg $ES
        return $ES
    fi
}

case "$1" in
    start)
    do_start
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

Permissions are 0755:

-rwxr-xr-x 1 root root 782 Mar 13  2014 /etc/init.d/rc.local
2
  • you misunderstood. it's not the /etc/rc.local that's missing (which would not be a big deal). it's /etc/init.d/rc.local
    – vch
    Jul 5, 2015 at 15:00
  • I've fixed it...
    – s3lph
    Jul 5, 2015 at 15:02

You must log in to answer this question.

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