A two-part problem I am having. I am using ArcSight Console and need to pass variables from ArcSight to a python script. However, I don't have access to standalone Python, only a Cygwin client to run python.
Step 1) Launch Cygwin and automatically run the python script
My current Cygwin batch file is:
@echo off
c:
chdir C:\cygwin\bin
bash --login -i
Step 2) Pass variables in the original command line to the python script for argv
python myscript var1 var2 var3
Am I taking the long way for this or am I attempting the impossible?
Solution
The batch file to launch cygwin now looks like this:
@echo off
c:
chdir c:\cygwin\bin
bash --login -i ./my_script.sh var1 var2 var3
my_script.sh is a bash script that passes the variables into python and launches the python script.
#!/bin/bash
echo "my_var1 = '$1'" > vars.py
echo "my_var2 = '$2'" >> vars.py
echo "my_var3 = '$3'" >> vars.py
python my_python.py
Python script imports the variables from the vars.py:
import vars
print "Foo is %s" % (vars.my_var1)
A huge pain but this was the way it had to be done due to security restrictions on what our work machines can install. Wanted to leave this here in case anyone else runs into a similar problem.
See the solution in my initial question.