?
Solved

Script for mounting Linux partition on Windows 2000

Posted on 2003-03-09
18
Medium Priority
?
337 Views
Last Modified: 2013-11-30
Dear Experts

Hi! I am stuck here for a solution, I am having a small ISP, I have configured mrtg graphs on my Linux machine which also happens to be my mail-server, I dont want any X-Interface on my mail-server, also I am having a windows-2000 server running, which is my web and dns. I want to show the mrtg graphs on the web-site and hence would be required to mount the linux partition on windows and every 5 minutes upgrade it so that I can show the current mrtg status.

please help me....

thanks in advance

smiles

sid
0
Comment
Question by:sidheart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +3
18 Comments
 
LVL 4

Expert Comment

by:Jivko
ID: 8101227
You can not access linux partition from Windows.
Why do not use MRTG for Windows?

Regards
0
 

Author Comment

by:sidheart
ID: 8101415
Dear Jivko

I am running mrtg on Linux, i want the graphs to be published on the net, my dns and web server is a win2k machine......

Thanks in adavance Jivko

Siddharth
0
 
LVL 4

Expert Comment

by:Jivko
ID: 8101426
You can use SAMBA to make MRTG grafs and .png-s accesible for your Windows2k machine.
0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 

Author Comment

by:sidheart
ID: 8101445
Dear Jivko

I am running mrtg on Linux, i want the graphs to be published on the net, my dns and web server is a win2k machine......

Thanks in adavance Jivko

Siddharth
0
 

Author Comment

by:sidheart
ID: 8101467
Dear Jivko

I totally agree upon running SAMBA on the linux server.....but my sysadmin wont let me do that, thats why i think a shell script for mounting a linux partition on windows and then updating it every 5 mins to get the current status and showing the graphs.

ragards

siddharth
0
 
LVL 4

Expert Comment

by:Jivko
ID: 8102010
Again
You can not access linux partition from Windows OS without SAMBA.
Also you can not mount linux partition in Windows without SAMBA.

Regards
0
 
LVL 1

Expert Comment

by:djluff
ID: 8102332
The easiest way to move the files with the software you already have would be to enable the FTP server on your windows machine, and have the linux machine FTP the files to it every time they're updated.

Or, the most secure way would be to use SSH/SCP. but this needs extra software on windows.

Other alternatives are:
- rcp (An rcp command used to come with NT 4 - in the resource kit I think).

- rsync (most efficient - only copies changes. needs extra software for windows)

Or, you could put apache on the linux server and use the windows machine as a reverse proxy. So you dont need to copy anything then.
0
 

Author Comment

by:sidheart
ID: 8108416
Dear DLUFF

Yes thats exactly what I am looking for, I need to write a shell script so that I can Move files after every update of the mrtg graphs.......please help me on this....but hats off you have a solution working here for me...also what extra software do I need for windows here?

0
 
LVL 1

Expert Comment

by:djluff
ID: 8110406
To use FTP pushed from a script on the Linux end, you just need an FTP server at the windows end, which you should already have in IIS, and an FTP client like ncftp installed on the linux end (should be already there).

So:
- enable FTP server on your windows machine (if its not already)

- Create a directory to receive the files (eg. d:\mrtg)

- create a virtual Web directory for d:\mrtg that shows up to the web users as "/mrtg" or whatever mrtg likes.

- create an FTP virtual directory for d:\mrtg that shows up as /mrtg for ftp users

- create a user account on the windows machine (say 'mrtg')

- give the 'mrtg' user NTFS and FTP write access to the d:\mrtg directory.

- write the script at the linux end to use 'ncftpput' or something to copy the files:

ncftpput -R -f login.cfg /usr/local/mrtg/* /mrtg
(or wherever the files are)

for ncftpget, the 'login.cfg' file contains:
host  web.server.name
user  mrtg
pass  whateverthepasswordis


I believe that you need to leave the files on the linux machine, as well as copying them to the windows server, because mrtg stores historical data there to let it calculate stats??

A couple of security items:
- If you're not using the FTP server for anything else, I'd apply IP restrictions so that only the linux machine has access.

- only give the 'mrtg' user access to the 'd:\mrtg' directory and nothing else. remember that ftp passes the username/password in the clear

- if it's at all security sensitive, you could consider using SSH rather than FTP, but this would need extra windows software.
0
 

Expert Comment

by:aceventura
ID: 8117408
Hi Sid,

From what I see, you need to transfer files from your
Linux box to your Win2K machine at periodical intervals.

What I'd suggest is
1. Get Expect (http://expect.nist.gov/)
2. Plug Expect into TCL (assuming you have TCL installed).
3. Using Expect you can write a script to FTP to your
   linux box and "get" the files of your choice back to
   your Win2K machine.
4. Now you do what you want with those files. You could
   have a batch file or even a TCL script that picks
   up the file on your W2K machine at intervals and
   performs some action.

Expect basically can be used to automate tasks - the kind
you are looking at. It is basically a set of SEND and
EXPECT requests. Ive used it successfully to automate
telnet and ftp sessions to get my work done.

Hope it helps.

Ashish
0
 

Author Comment

by:sidheart
ID: 8118550
Dear Ashish

Thanks , can I use scp script if I implement a SSH server on linux and a client on the windows machine.

I am trying to implement DJLUFF solution tooo.

The restriction I have is that I dont want any X-interfaces on my linux machine.
What are the options that I can give to scp for transferring files automatically on windows and then updating again after some time.

Ashish can you please be a bit elobrotive on the script that you have implemented.

thanks in advance

siddharth
0
 

Author Comment

by:sidheart
ID: 8164241
Dear Experts

I have tried using ncftpput
through

ncftpput -R -f login.cfg /inst/mrtg/webroot/ /mrtg

where I have made a file login.cfg
and my png files are in directory webroot and destination id /mrtg

I am getting an error:

login.cfg : name or service not known
cannot recover from micellaneous open error -105.
ncftpput: cannot open /login.cfg: unkown host

please help

0
 

Expert Comment

by:aceventura
ID: 8166072
Hi Sid,

Sorry for the delay in replying. Have been really busy.
Part of life eh ?

What I was talking about is something very basic.

You want to get you graphs from your Linux machine to your
Win2K machine at regular intervals right.

As mentioned earlier, you could automate this task using
Expect.

From your Win2k machine execute a script similar to the
following

# script starts
package require Expect

set FILE   "<filename>"
set WIN2K  "<IP ADDRESS>"

set timeout 60
spawn ftp $WIN2K
expect "User(*):"
send "<username>\r"
expect "Password:"
send "<password>\r"
expect "ftp>"
send "binary\r"
expect "ftp>"
send "cd <directory_where_file_is>\r"
expect "550*ftp>" exit "250*ftp>"
send "get <file_you_want_to_get>\r"
expect "550*ftp>" exit "200*150*226*495*ftp>"
bye

# script ends

Now the file has reached your Win2k machine. Either you
write another script that calls this script to get
the file at intervals (you can use "after" in a while
loop) and then the file is yours to do what you want.

Ashish

0
 

Expert Comment

by:aceventura
ID: 8166097
Instead of using two scripts, you might find it easier
to handle one script.
You could put the code to ftp in a proc and then

while {1} {
       
     after 5000 { get_file }
     # now the file is in your current dir
     # it's yours to do what you want

}

You could also use mget instead of get while ftp-ing if
you want to get multiple files.

Hope it helps

Ashish
0
 

Expert Comment

by:aceventura
ID: 8283225
Boss,

Any luck ?
Just curious.

Ashish
0
 

Author Comment

by:sidheart
ID: 8434467
Dear Ashish

Hi! Hello! how are you? I am extremely sorry , I was on deputation and just saw your mail. I finally installed apache webserver and wrote an entry in cron and init.d to automate the process.

Will bother you for help on mrtg which I am stuck with ...

Best wishes and kind regards

Siddharth
0
 

Expert Comment

by:CleanupPing
ID: 9153191
sidheart:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9846254
PAQed - no points refunded (of 250)

SpazMODic
EE Moderator
0

Featured Post

Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question