Grab something like grep for windows: http://www.interlog.com/~tcharron/grep.html
and use something like: @echo off if "%~1"=="" exit 0 if not exist "%~1" exit 0 set /a maxfileSize=2048 if /i %~z1 GTR %maxfileSize% exit 0 grep "your-sec-code" %~1 if not %ERRORLEVEL%==0 exit 0 echo your reboot code here. exit 0 waassssuu pppp wrote: >No issues and no problems but I want to be able to do it if I want to. > >I just need help with the script if you saw it in the previous email. > >I need a way to look in the body of an email for a code and if it sees that >code proceed with the script. > >Its not really a bad idea or security problem. You can use filters and >filters.in.tab to make it only work if it gets the email by what ever email >you tell it. > >Sometimes us admins are on the road and driving and get a call and lets say >all that needs to be done is a server reboot and the server is behind a >locked door at the office that only you and the ceo have a key too and both >of you are not in office. >Well I could pull over and breakout the lappy , connect to the internet and >remote in ORRRRR I could hang up with the person that called you and you >can send an email via phone to the server and it would reboot. > >It would be even better if you could specify the machine to be rebooted by >computer name in the body of email. > > >FILTERS IN.tab >"[EMAIL PROTECTED]""[EMAIL PROTECTED]""0.0.0.0/0""0.0.0.0/0""reboot.tab" > >/Filters >reboot.tab >"cmd.exe /c D:\Xmail\xmail_filters\email-reboot.cmd""@@FILE""@@RCPT" > > >On 4/1/06, John Kielkopf <[email protected]> wrote: > > >>Your last two emails, and your test came through here fine. >> >>I'm not sure what you're asking exactly, but if it's for an opinion; I >>don't think restarting via email is a great plan. Surely, if you have >>the need to reboot your server like this, there are other issues with >>the server that need resolution? >> >>--John >> >> >>Mr Sexy wrote: >> >> >> >>>Ok I know this is probably not a good idea but lets entertain the >>>thought and possibilities. >>> >>>This is xmail 1.20 on win32 system and what I want to do is be able to >>>email to the server and have a code in the body of the email and when >>>it reaches xmail, xmail will look at it and check to see who the email >>>is from and if its a valid user it will look for the code in the email >>>to proceed to a batch file that reboots the machine. If the code is >>>incorrect, it just discards it. >>> >>>Im not the best at batchfiles but I get by :) >>> >>>So far I came up with this but I need help. >>> >>>The server name is server1 >>>This file will be named email-reboot.cmd and placed in >>> >>> >>D:\Xmail\xmail_filters >> >> >>>Not sure if the REM statement is needed or not. >>> >>>@Echo off >>>set xmailfile=%~1 >>>REM if "%xmailfile:~0,4%"=="\\?\" set xmailfile=%xmailfile:~4% >>>if not"%~2"=="[EMAIL PROTECTED]" exit 0 >>>copy %xmailfile% D:\Xmail\xmail_filters\tmp >>>D: >>>cd \ >>>cd Xmail\xmail_filters\tmp >>> >>>(need something here to look for code) >>> >>> >>> >>>del *.server1 /Q >>>endlocal >>>exit 4 >>> >>> >>> >>>Ideas? >>>- >>>To unsubscribe from this list: send the line "unsubscribe xmail" in >>>the body of a message to [EMAIL PROTECTED] >>>For general help: send the line "help" in the body of a message to >>>[EMAIL PROTECTED] >>> >>> >>> >>> >>> >>> >>- >>To unsubscribe from this list: send the line "unsubscribe xmail" in >>the body of a message to [EMAIL PROTECTED] >>For general help: send the line "help" in the body of a message to >>[EMAIL PROTECTED] >> >> >> >> > >- >To unsubscribe from this list: send the line "unsubscribe xmail" in >the body of a message to [EMAIL PROTECTED] >For general help: send the line "help" in the body of a message to >[EMAIL PROTECTED] > > > > - To unsubscribe from this list: send the line "unsubscribe xmail" in the body of a message to [EMAIL PROTECTED] For general help: send the line "help" in the body of a message to [EMAIL PROTECTED]
