/etc/rc.local in CentOS 7
I want to mount .iso file after every booting of system. I know in centos-7 the /etc/rc.local file is not executable and need to change permission to run it like previous version. But i have made the changes but still after booting the .iso file is not mounted. Please advise.I have used the below command in rc.local file and make it executable.
mount -o loop /media/xxx-xxx.iso /mnt/dvd |
You also have to enable the rc-local service in systemd.
|
Just out of curiosity, why not just add the mount to /etc/fstab (or better write a proper .mount file for it)?
|
Hi Tobi,
Actually I was about to suggest that but then I thought if by mistake he moves that iso file to somewhere else then with entry in /etc/fstab it will leave the system unbootable. |
Use 'noauto'
|
Yes, noauto can be used but I guess that will fail the purpose as then it has to be user,noauto.
|
Don't move the iso file? Make it immutable, and put the loop into the fstab file...
You can't have it both ways. Either the mount is permanent and it can go in fstab as-is, or it is temporary and likely to change and needs to be put in fstab with noauto. |
Thanks guys.Actually I just want to play with new rc.local in centos-7.Yes I could put it in fstab but I really want it in rc.local to perform my some other experiment.
|
Quote:
@reboot alias for cron see "man 5 crontab" Code:
@reboot /path/to/mount.sh |
Quote:
If so, there is no need for having scripts to handle those filesystems, you can simply use tune2fs to disable those fsck runs at boot, have a look at the -c and -i options. |
@dipanjan did you ever solve this thing with rc.local in centos 7? I have the same problem, this thread goes nowhere, tia if you can share any solution you may have found....
|
/etc/rc.local or /etc/rc.d/rc.local are no longer executed by default due to systemd-changes. (as mentioned in the first post, but just to be sure)
to still use those, you need to make /etc/rc.d/rc.local executable: Code:
chmod +x /etc/rc.d/rc.local Code:
/root/script.sh to be sure that your script is executable, just do a chmod +x /root/scripts.sh To debug your problem, it would be a good idea to redirect the output of the script (if there is any) to a logfile to be sure if the script has been executed or not. |
similar:
http://www.linuxquestions.org/questi...al-4175514081/ i have another frustration with fedora. why is it that if i put my thumb drive in /etc/fstab and i boot up with it unplugged, the machine will drop me in a minimal root shell ? |
Quote:
More info on systemd mount options here: http://www.freedesktop.org/software/...emd.mount.html |
All times are GMT -5. The time now is 06:52 AM. |