Network drive in Fedora
AlphaTrinity
North Wales, PA
I am in a Linux (specifically Fedora 8) class in college right now, and our "final project" is it come up with a script that does something useful. At work I just learned how to map network drives using a Windows environment by using, for example:
net use J: \\server\sales
I thought maybe a good "final project" in my class would be doing the Linux equivalent of that script. Is there such a thing in Fedora 8?
net use J: \\server\sales
I thought maybe a good "final project" in my class would be doing the Linux equivalent of that script. Is there such a thing in Fedora 8?
0
Comments
Plus that command differs depending on if if you are mapping to a windows share or a *nix share so it's not really a script that you'd be working with. It'd be more just submitting a new mount point to your mtab file.
I have to agree. Doesn't sound like much of a project to me. What was the assignment exactly im sure the teacher didn't just say "do something with linux."
I thought that automatically mapping network drives would be a good administrative task since I do that at work already. Maybe I can go further with the project and make a logon script that will call a script linked to the user name that will then have all of the network drives that specific user needs. I agree that it's a simple project, but I think that's the point; it's not a very in depth class, more like a general study of Linux.
a file called mapper.bat
echo off
@echo off
net use j: \\server\share$
Not really much of a project.
What about;
A script that runs rsync to backup your existing system to an external device. That would be something more useful.
A script that runs hourly and requeue's any network printers.
A script for removing a user, that first backs up his home directory to backup directory then deletes the user, his home directory and removes him from any lists/groups he's in.
A script that does a software update check and then emails the admin of available updates.
A script that goes through user folders looks for .mp3's for example and deletes them - if MP3's are something you don't want users storing on the network.
I like that one, and I can definitely see that being used in the real world. Thanks for the advice.
Is there any advice you guys can give me? Or I guess you would rather wait until I've already exhausted google...
Thanks again for the idea kryyst; my professor agreed with you all that mapping a network drive was a bit too simple, but said I could have still done it. I like the .mp3 network erase though, so I'll stick with it.
Attached are some scripts I've been working on, with a couple warnings.
1. Don't blindly run these, it may cause damage.
2. It's not even half done, and doesn't do anything yet.
Which is a good thing, because I wouldn't want to hand you your final. I just wrote this off the top of my head. I haven't had time to finish or even test run any of it, but there's a lot of examples in here that you will need in the real world.
These are used to manage web servers. A good project would be to write a simple script that added domains to a web server by creating the required directories and config files.
If you really want to stay with .mp3's here's your project.
updatedb; for i in `locate *.mp3` ; do echo removing $i ; rm -f $i ; done
Here's another that takes longer
for i in `find /. -name '*.mp3'`; do echo removing $i ; rm -f $i ; done
Notice the for loop? If you pass too many arguments to a command it may cause it to exit. For example,
rm -f `locate *.mp3`
Is a very very bad thing to get into the habit of.
Have fun. Scripting is probably the most important thing you can learn to administrate linux machines. You will want to bookmark this site as well
http://tldp.org/LDP/abs/html/
*edit start with the adddomain file and work from there. Some of the other scripts are just generic for my environment.
Perhaps it would be more beneficial to move them into a 'holding' folder first then you can approve any deletions and see who put them there by looking at the user perms. You could also get more tricky and check to see if there is some commonality to the construction of an .mp3 files header. Then do a find to actually look into the header of files for that chunk of data and flags it as well.
Happy scripting.
find /holding -type f -exec /bin/rm -f {} \;
At least..I think that's right.
I can't find a way to move all .mp3s on the network to that folder though. I've found scripts that will backup files on a local machine, but not through the network. Maybe it's too complicated?
This should find all files defined (default *.mp3)
It will move them to a holding location, and email the admin a list of files found. Also, it will delete the old files in the holding cell. The rest should be understandable by reading the code.
Please don't copy this and hand it in. If anything, see how I did it and write it in your own style. I doubt your code looks quite like mine, you teacher can probably already spot your 'style'
I basically took your script and some other stuff I found online..crunched it all together and then cleaned it up with my personal touch.
Thanks a lot for the idea kryyst, and thanks a lot for the script that saved me hours and hours of time Rob. I even credited you in my report as IC Rob