10

Is there a way of getting logs for startup processes in /etc/init.d?

I am running Raspbian (Debian Wheezy).

dmesg shows boot log, but does not go far enough.

Some time ago I added a script to start tightvncserver and have seen similar scripts posted by others.

This never seems to start, but I am at a loss to find out why. I would like to see if there are any errors generated.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see: 
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required

eval cd ~$USER

case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    pkill Xtightvnc
    echo "Tightvncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0
2
  • 1
    dmesg only shows kernel logs. What distribution is your system running? And what init system, if your distribution gives you a choice? Aug 25, 2015 at 22:49
  • 1
    For upstart init systems on ubuntu 14.04, check for logs under /var/log/upstart/YourServiceName.log.
    – user93868
    Aug 26, 2015 at 2:00

3 Answers 3

6

Try service tightvncserver start (as root) in the running system, it may give you some hints. If not, your best option is using a serial console and logging its output. If that isn't possible, bootlogd may be able to help you out. If you get nothing, maybe you forgot to activate your init script. What's the output of the

$ ls /etc/rc?.d/*tightvncserver

command? If nothing, try (as root)

# update-rc.d tightvncserver defaults
5
  • Thanks. This showed that su was waiting for the password. I have added the startup script above.
    – Milliways
    Aug 26, 2015 at 2:25
  • 1
    Did you run the service command as root? su should not require a password when invoked by root. On the other hand, see man start-stop-daemon, that helps a lot with these tasks. Aug 26, 2015 at 6:49
  • I run the Pi headless, and am connected as user pi via ssh. The point of the original question was why the init.d script does not run tightvncserver on boot, which should be running as root.
    – Milliways
    Aug 26, 2015 at 7:02
  • That's exactly why you should run the above test as root. Aug 26, 2015 at 7:21
  • Logged on as root - sudo su and got no errors and service tightvncserver start runs OK. Installed bootlogd - no mention of tightvncserver, and it still doesn't start on boot.
    – Milliways
    Aug 27, 2015 at 5:40
1

Check if you have a /var/log/boot file.

0

For Fedora based linux, maybe you can check /var/log/messages file.

You must log in to answer this question.

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