startup script
hi guys, how i can set this command as a startup script?
mount -t cifs //192.168.1.17/Email -o username=admin,password=xxx111 /home/backup/Email thanks for any input :) |
Hi,
that can be done, but normally this is achieved by adding a line to your /etc/fstab, since during bootup all entries in the /etc/fstab that *don't* have the option "noauto" will be mounted. The line you would want to add would be something like: Code:
//192.168.1.117/Email /home/backup/Email cifs username=admin,password=xxx111 0 0 Code:
username=admin Code:
//192.168.1.117/Email /home/backup/Email cifs credentials=/root/.cifs.conf 0 0 Evo2. |
hi evo2, for whatever reason I already have that on my fstab but it's not working.
that's why i'm thinking to have that as a startup script and execute the command. thanks. any ideas if I could set a shell script to do it? |
Hi,
you should not need to run a start up script. Instead you should try to debug why it is not being mounted. Have you checked your log files? Does, running it manually work? Eg with root privs: Code:
mount /home/backup/Email |
i have this on my fstab:
//192.168.1.17/Email /home/backup/Email cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=admin,password=xxx111 0 0 it's not working any ideaS? |
Quote:
Thanks. :) any ideas? |
@JJJCR: If you are able to run mount /home/backup/Email without any errors then the fstab entry itself is good. The mount command used from the command line doesn't have all the options that are needed, so the system will look in the fstab file and use what's there to complete the mount command.
Maybe the fstab order in which things are mounted isn't correct. / (and possibly /home) should be mounted before you try to mount the cifs mount. |
hi druuna, thanks for the reply. I can't really try it now even though I wanted to.
The server is on-line, users will jump on me, if I will reboot the server to try. i'll find a good time to test it out. The command I used on the fstab is this: //192.168.1.17/Email /home/backup/Email cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=admin,password=xxx111 0 0 is there anything i'm missing out on the line? Thanks. |
Quote:
Quote:
BTW: You could use rc.local instead of fstab to mount the share. Add something like this: mount /home/backup/Email |
hi druuna, i will test out the rc.local it's a good idea.
Actually, the reason i want to reboot the server because I want to check whether the mounting will be done automatically. Because sometimes there's a power shutdown on the building, I will just turn on the machine and a few days later I will realize that I have to mount some folders that is needed by the server. So in order not to miss out this thing, I want it to be done automatically. Thanks for all the ideas guys.. :) |
I did some Googling, would this be right to put on rc.local?
sleep 70 && mount //192.168.1.17/Email /home/backup/Email cifs & |
I assume the fstab entry doesn’t work as the network is not yet 'up'
I would be tempted to have noauto in the fstab, and in your rc.local Code:
mount /home/backup/Email & I suppose 'backgrounding' the mount is ok ( added as red ) However, a cronjob with @reboot ( which means on boot ), might be better setup correctly you will get a report if it goes wrong... Having typed all that, fstab/mount should be smart enough to wait until networking is up ( based on it being type cifs ) But you could try adding _netdev to the options in fstab As has already been pointed out by Evo2, you should be using credentials ( with 0600 perms ) try this.. Code:
//192.168.1.117/Email /home/backup/Email cifs _netdev,credentials=/root/.cifs.conf 0 0 |
Quote:
mount -a will mount those entries that aren't mounted and do not have the noauto flag. Any new (or unmounted) entry in the fstab file can be mounted this way. However, mount -a doesn't look at the order of the entries. The above won't replace a reboot, but it will give you a very good indication if the individual(!!) entries are processed correctly. Quote:
A simpler mount command would do: mount /home/backup/Email & I do assume that the cifs entry is present in your fstab file (and, as mentioned by you in post #6, mounting from the command line works). If the cifs entry isn't present in fstab then you need the full blown mount command to be in rc.local, something like this: Code:
mount -t cifs -o username=admin,password=xxx111 //192.168.1.17/Email /home/backup/Email & Code:
mount -t cifs -o credentials=/root/.cifs.conf //192.168.1.17/Email /home/backup/Email & |
hi druuna, i'm not aware of the mount -a option. Thank you I will try it.
I will give it a shot. @Evo2, thanks for pointing out the rc.local security that it will be visible to other users. @Firerat, thanks for pointing out about the network. The mount option is pointing to the NAS. I wasn't sure whether I turn on first the server, then after that I turn on the NAS. Yup it could be that the NAS was not yet up when the email server was already up. The suggesstion of druuna, about the mount -a option i will try that one. Thank you guys for all your ideas and help. Keep you posted with the result. ;) |
Just read your last post,,
didn't realise something might be down ( the NAS ) You could have the @reboot cronjob test if the nas is available and mount, If not send a WOL to it, sleep a little and test and hopefully mount have it in an until loop ( until it succeeds or fails too many times ) properly written it can report failure |
All times are GMT -5. The time now is 02:35 AM. |