rpi25
Posts: 23
Joined: Sat Feb 21, 2015 2:31 am

External HD no longer mounting after adding init.d script

Wed Feb 25, 2015 11:49 pm

I was messing around trying to learn how init.d scripts work. I took a process that was working well when I had it in cron scheduler as @ reboot and tried to make it an init.d script. Pulling from an example I found for initializing a vnc server on boot (http://elinux.org/RPi_VNC_Server#Run_at_boot), I wrote my own init.d script:

Code: Select all

sudo nano /etc/init.d/btsyncboot

Code: Select all

#!/bin/sh
### BEGIN INIT INFO
# Provides: btsyncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start btsync at boot time
# Description: Start btsync at boot time.
### END INIT INFO

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting btsync"
   /home/pi/.btsync/btsync --config /home/pi/.btsync/sync.conf
   ;;

 stop)
   echo "Stopping btsync"
   /home/pi/.btsync/btsync -kill
   ;;

 *)
   echo "Usage: /etc/init.d/btsyncboot {start|stop}"
   exit 1
   ;;
esac

exit 0

Code: Select all

sudo chmod 755 btsyncboot

Code: Select all

sudo update-rc.d btsyncboot defaults
So I rebooted my pi, it started btsync and I could load the web GUI so looked like things were working. Then I noticed all the folders said they could not be accessed. Thought that was weird so I tried changing to my external hard drive

cd /media/external

and got this error message

Code: Select all

-bash: cd: external/: Permission denied
If I look in the /media folder I still see it listed, but I cannot access it, even using sudo

So I'm not sure what happened, but I'm assuming it has something to do with me messing around in the init.d scripts.

Can anyone point out where I went wrong, and how to fix it?

Thanks!

rpi25
Posts: 23
Joined: Sat Feb 21, 2015 2:31 am

Re: External HD no longer mounting after adding init.d scrip

Wed Feb 25, 2015 11:56 pm

I tried to get a temporary fix by undoing what I had done

Code: Select all

sudo update-rc.d -f btsyncboot remove
and by renaming the script in the init.d folder, but now on reboot I still get the same problem where I cannot access my external hard drive (though now at least btsync is no longer autostarting)

Return to “Raspberry Pi OS”