I need to execute a Babun script with Windows Scheduler on Windows Server 2003, the problem is: How can I execute a script in Babun shell from a .bat
or similar?
The script is a really simple one line rsync
command.
Here is the Babun reference.
first copy .babunrc
to .babun_scheduler_rc
and add one line export PATH="/usr/bin:$PATH"
The location of .babunrc
is: C:\Users\user\.babun\cygwin\home\user
you can edit it from babun too.
next create the script.bat
:
@echo off
setlocal enableextensions enabledelayedexpansion
set SCRIPT_PATH=%~dp0
set SCRIPT_PATH=%SCRIPT_PATH:\=/%
set BABUN_HOME=%SCRIPT_PATH%
set CYGWIN_HOME=%BABUN_HOME%\cygwin
set BASH=%CYGWIN_HOME%\bin\bash.exe
"%BASH%" -c "source ~/.babun_scheduler_rc && rsync -Crav /cygdrive/c/Path/To/Copy user@remote:/tmp/path/to/copy"
and now you can add it to the scheduler.