shortcut to execute command in cygwin bash

I have a command
unison myprofile -batch
which works fine in cygwin bash shell. It uses ssh, unison and probably rsync to work.
How can I make a windows shortcut that can execute this command?
NewtonianBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
wesly_chenCommented:
Assume that your cygwin is installed at c:\cygwin\

1. In cygwin , create and shell script called backup.sh with the following content
---- /home/<your login name>/backup.sh  ----
#!/bin/sh
/full-path-to-unison myprofile -batch
--------------------

2. Open the notepad, create a batch file on desktop with this content
---- backup.bat -----
c:\cygwin\bin\sh.exe  /home/<your login name>/backup.sh
---------------

3. The double click on backup.bat. Or you can create a shortcut for backup.bat.
0
 
NewtonianBAuthor Commented:
Thanks wesly I have a problem though something is screwy seems to be happening with unison when ran from this bat script. Some paths are different.

All that syncprofile has is
root = /cygdrive/c/myfolder/
root = ssh://user@server//cygdrive/c/myfolder/


Through the bat script instead of getting

unison syncprofile -batch
Contacting server..
Connected //MYSERVER//cygdrive/c/myfolder -> //LOCAL//cygdrive/c/myfolder
Looking for changes
      Waiting for changes
      Reconciling changes
     
      
I get      

C:\Users\NEWTON\Desktop>c:\cygwin\bin\sh.exe  /home/NEWTON/backupscript.sh
Contacting server...
Looking for changes
Warning: No archive files were found for these roots, whose canonical names are:

        /cygdrive/c/Users/NEWTON/Desktop/syncprofile
        /cygdrive/c/Users/NEWTON/Desktop/
This can happen either
because this is the first time you have synchronized these roots,
or because you have upgraded Unison to a new version with a different
archive format.

Update detection may take a while on this run if the replicas are
large.

Unison will assume that the 'last synchronized state' of both replicas
was completely empty.  This means that any files that are different
will be reported as conflicts, and any files that exist only on one
replica will be judged as new and propagated to the other replica.
If the two replicas are identical, then no changes will be reported.

If you see this message repeatedly, it may be because one of your machines
is getting its address from DHCP, which is causing its host name to change
between synchronizations.  See the documentation for the UNISONLOCALHOSTNAME
environment variable for advice on how to correct this.

Donations to the Unison project are gratefully accepted:
http://www.cis.upenn.edu/~bcpierce/unison

Reconciling changes
Nothing to do: replicas have not changed since last sync.

C:\Users\NEWTON\Desktop>pause
Press any key to continue . . .
0
 
wesly_chenCommented:
where is your myprofile -batch file in cygwin?

---- /home/<your login name>/backup.sh  ----
#!/bin/sh -x
/full-path-to-unison  /full-path-to-myprofile -batch
--------------------
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
NewtonianBAuthor Commented:
It's in
C:\cygwin\home\NEWTON\.unison\myprofile
0
 
wesly_chenCommented:
The path within cygwin, not Windows
Is it  /home/NEWTON/.unsion/myprofile ?
The modify the backup.sh with the full path to myprofile
0
 
NewtonianBAuthor Commented:
yes that's the path, I tried that unfortunately same problem umm
0
 
wesly_chenCommented:
1.  Within cygwin
$ cp  /home/NEWTON/.unsion/myprofile  /cygdrive/c/Users/NEWTON/Desktop/syncprofile

2.
---- /home/<your login name>/backup.sh  ----
#!/bin/sh -x     # <== debug mode
/full-path-to-unison /cygdrive/c/Users/NEWTON/Desktop/syncprofile  -batch

3.
---- backup.bat -----
C:
set HOME=\Users\NEWTON
set _NEWTON_CYGWIN=true
c:\cygwin\bin\bash  -c '/home/NEWTON/backup.sh'
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.