This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to detect if Windows or Linux is running?

On Thu, Dec 01, 2005 at 05:19:35PM -0500, H. S. wrote:
>Christopher Faylor wrote:
>>On Thu, Dec 01, 2005 at 05:07:15PM -0500, H. S. wrote:
>>>I have installed Cygwin on a Windows XP computer to get rsync and ssh 
>>>running so that I can backup my important data on a Linux computer on my 
>>>home LAN. The idea is to use rsync to make rolling backups of my Windows 
>>>data automatically, say, once or twice a day and to retain last N 
>>>backups (N most probably going to be 10~20).
>>>But the problem I had not foreseen is that I dual boot this Windows 
>>>machine between Windows XP and Debian. How should I gracefully let the 
>>>rsync server know if this computer is running Linux or XP?
>>>I know that if the computer is running Linux, the rsync server will 
>>>never find /cygdrive/... folders and will just quite with an error. But 
>>>this is not 'clean', it will result in mails to the rsync server root 
>>>about the error.
>>Why not just use mount to mount things similarly on the cygwin side
>>and the linux side?
>Even if I do that on the machine to be backed up, I still need to know 
>what OS is running. This is for the situation in which I want to 
>maintain different backups of Linux and of Windows data. To do this, 
>rsync must now what it is backing up so that it does not overwrite 
>previous backups of one OS with the new ones of the other.
>Or I misunderstood your post.

If you are just trying to figure out if you're running as cygwin or
linux there are many ways to do this.  You already mentioned that linux
won't have a /cygdrive.  That could be a key.

Otherwise, the standard way to check this is using uname -s.

If you are trying to figure out from the server side if the system is
running linux or cygwin then the existence of /cygdrive should do it.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]