Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 16697  / 1 Year ago, sun, march 26, 2023, 12:41:30

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?


More From » boot

 Answers
2

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:



# mount CIFS share

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

pre-start script /bin/mount /mnt/mediaDrive
pre-stop script /bin/umount /mnt/mediaDrive


You can modify it to suit your needs. The file name must end with .conf and saved in the /etc/init directory.


[#28246] Sunday, March 26, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
istictroubli

Total Points: 306
Total Questions: 96
Total Answers: 114

Location: Sao Tome and Principe
Member since Wed, Jul 13, 2022
2 Years ago
istictroubli questions
;