2016-06-29 13:50 GMT+03:00 Jaren Peich <burkol...@gmail.com>:

> Hi Risto,
>
> ...
>
> launchBat.bat(Creates a file with 1 line, event)
> ____________________________________________________________________
> echo|set /p=restartAlert>C:\signal.txt
>
>
> type=Calendar
> time= 2 * * * *
> desc=Execute_bat
> action= shellcmd  C:\launchBat.bat;
>
> type=Calendar
> time= * * * * *
> desc=Check_File
> action= eval %o (if (-e 'C:\signal.txt'){print "\nExists!!!!\n";});
> rem Function to check file.Here from perl function launch another bat kill
> the process and restarting sec.
>
> In this case i tested and sec doesn´t launch "Execute_bat" rule and the
> other one too, just when i change time variable to * * * * * and the second
> rule in this case doesn´t launch.
>


That's quite strange. I've tested your Calendar rules on Linux, and they
are triggering actions at specific moments (the first rule at the 2nd
minute of every hour, and the second rule in every minute). The second rule
has a minor syntax error, though -- there should be an equal sign after
'rem':
rem=Function to check file.Here from perl function launch another bat kill
the process and restarting sec.

But otherwise the above Calendar rules are running actions as expected, so
I am quite clueless why they are not producing desired effect in your wider
setup.


>
> Second, I was reading the sec manual and i thought something like this:
>
> launchBat.bat
> ____________________________________________________________________
> echo restartAlert-->i generated reload event as input
>
> type=Calendar
> time= * * * * *
> desc=Execute_bat
> action=spawn C:\launchBat;
>
> type=single
> continue=takenext
> ptype=regexp
> desc=reload_rule
> pattern=.*restartAlert.*
> action=lcall %o -> (sub{$main::refresh = 1;})
>
> Which is the diference between spawn and cspawn?Is it possible to use like
> that to simulate the signal and capture from the bat?
>

Both 'spawn' and 'cspawn' actions run an external command, and every line
that the command writes to its standard output is captured by sec, and
treated as a synthetic event. The difference between 'spawn' and 'cspawn'
is the following -- with the 'spawn' action, sec creates a context
_INTERNAL_EVENT for each synthetic event received from the command. In
contrast, you can define a custom context name for each synthetic event
with 'cspawn'.

Nevertheless, 'cspawn' is supported since sec-2.7.6, and if you are using
sec-2.6.2, you can only use 'spawn' in your rules. Nevertheless, there is
also one thing you have to take into account -- the 'spawn' and 'cspawn'
actions are supported on Windows only if you are using Cygwin perl, since
Activestate and Strawberry are unable to emulate reading from pipes in a
proper way.


>
> I tested this way but i have no result.No rules launched.
>
>
>
That could be caused by the fact that you are not using Cygwin. If that is
the case, sec writes the following error message into its log:
'spawn' action is not supported on Win32

I would also recommend to check the sec log for troubleshooting the
Calendar rules -- they might provide some hints why the actions executed by
these rules are not influencing the rest of the rulebase.

hope this helps,
risto
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to