debian squeeze: where do the logs for sysv init scripts go? (why won't my init script work)

6,240

Solution 1

The output of initscripts are not logged anywhere, any output goes to the console. To log the output of the script add this at the top:

exec 1>/tmp/init.log 2>&1

You may also want to add set -x to see exactly how it's being interpreted.

Solution 2

On Debian Wheezy, do

apt-get install bootlogd

On previous versions, it is already installed but you need to enable it in /etc/default/bootlogd.

The output is then logged to /var/log/boot

See https://wiki.debian.org/bootlogd for a few more details.

Share:
6,240

Related videos on Youtube

sbeam
Author by

sbeam

Long time web veteran from the trenches with a long history of successful self-employment and business ownership. Had a HP-UX UNIX account when I was 13, installed Redhat 5.2 on a 486 and built crazy huge CGI scripts in C and perl in the day. Now using Ruby, PHP, Python and sometimes even Java when I feel like being abused. I'm a pragmatist that enjoys FOSS and uses GNU/Linux for almost everything from tiny field data monitors, to enterprise HA clusters, to my desktop.

Updated on September 18, 2022

Comments

  • sbeam
    sbeam almost 2 years

    my actual problem is trying to debug a init script to start Resque. It works fine run as root from the command line, but does nothing on boot. It has some proper insserv headers and I've run updaterc.d to create the symlinks, and checked that they exist. The script is +x.

    # find /etc/rc*.d -name \*resque\*
    /etc/rc0.d/K01resque
    /etc/rc1.d/K01resque
    /etc/rc2.d/S01resque
    /etc/rc3.d/S01resque
    /etc/rc4.d/S01resque
    /etc/rc5.d/S01resque
    /etc/rc6.d/K01resque
    
    # ls -l /etc/init.d/resque 
    -rwxr-xr-x 1 root root 2093 Oct 24 03:02 /etc/init.d/resque
    

    the script can be viewed here if you like. It uses lsb functions to log messages, which essentially echo() to STDOUT I believe. So where does the output go during startup? It's not in /var/log/*log

  • sbeam
    sbeam over 11 years
    works great. although resque still isn't coming up on boot at least I know it's not the init script. thanks!