Here is my current /etc/rc.local
:
#!/bin/sh -e
# Test 1
echo line1 > /home/myHome/rclog.txt
# the mount
mount /mnt/mediaDrive &> /home/myHome/mountlog.txt
# Test 2
echo line2 >> /home/myHome/rclog.txt
exit 0
The /mnt/mediaDrive
is a noauto
in fstab
. It is a network share, hence the mount in rc.local
.
The mount in the above script does not work at boot. After boot, the rclog.txt
file contains both line1
and line2
, and the mountlog.txt
file is empty. This would indicate that all commands in the script were run successfully, however, the drive is not mounted.
Running sudo /etc/rc.local
manually in a terminal does mount the network share.
There is nothing relevant in /var/syslog
that I can see, and permissions for rc.local
are 755. The relevant fstab
entry:
//192.168.1.100/home /mnt/mediaDrive cifs noauto,credentials=/home/myHome/.mediaCredentials,uid=myName,gid=myGroup 0 0
What's going on here?
Best Answer
The problem must be that at boot time your network isn't available yet, and it's the reason why it mounts after boot. You must use another mechanisms to mount the device, like upstart. Example using upstart:
You can modify it to suit your needs. The file name must end with
.conf
and saved in the/etc/init
directory.