Advertisement
Guest User

TOR runner with TRAP section only. tor.pid in absolute path.

a guest
Jan 11th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* TOR runner */
  2. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  3. call 'SysLoadFuncs'
  4.  
  5. PARSE UPPER ARG param
  6. curdir = directory()
  7. newdir = directory('C:\tcpip\services\TOR\bin')
  8. PIDFile = 'D:\var\pid\tor.pid'
  9.  
  10. SELECT
  11.  WHEN param = 'STOP' THEN
  12.       DO
  13.          param = 'result = '||param||'()'
  14.          interpret param
  15.       END
  16.  OTHERWISE
  17.  result = 'Valid parameters are: START STOP RESTART'
  18. END
  19. say result
  20. call directory curdir
  21. exit
  22.  
  23. STOP: PROCEDURE EXPOSE PIDFile
  24. IF STREAM(PIDFile, 'C', 'query exists') = PIDFile THEN
  25.    DO
  26.       call stream PIDFile, 'C', 'close'
  27.       '@so kill 'linein(PIDFile)' > nul 2>&1'
  28.       call SysSleep 3
  29.       rc = SysFileDelete(PIDFile)
  30.       res ='TOR stopping result is: '||rc
  31.    END
  32. ELSE res = 'TOR is not running!'
  33. return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement