I know this question has been asked a lot of times already, and I think I might have tried everything suggested on the internet, but I just can't get it running


#!/bin/sh -e

while :

    alsactl restore
    if [ $? = 0 ]
        echo "alsactl restored" >> ~/Desktop/rc.log
        echo $?
    sleep 2


exit 0

permissions are

$ ls -l /etc/rc.local
-rwxr-xr-x 1 root root 855 Jul   5 17:05 /etc/rc.local

any ideas?

Ubuntu 14.04

  • You need to add exit 0 at the end of the /etc/rc.local file..run this sudo bash -c 'echo "exit 0" >>/etc/rc.local' – heemayl Jul 5 '15 at 16:55
  • oh, yes, it is there already, my bad - didn't copy it to the end. fixed the question – John Constantine Jul 5 '15 at 18:11
  • Does /root/Desktop exist? If not, the script will error out either way since you have -e on the shebang. – muru Jul 5 '15 at 18:12
  • You need to have the full path to all commands since rc.local is run before $PATH is set – Grammargeek Jul 5 '15 at 19:50

Your Answer

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

Browse other questions tagged or ask your own question.