Jump to content
The Uniform Server Community

STunnel question


Recommended Posts

I've been playing with the Uniform Server, and it's working great so far. I do have a question, though. Is there a method for automatically starting STunnel when the server starts? I'd like to have it start up right away without having to go to the "plugins/Stunnel-4.05/index.html" page and clicking on the cgi link.

Link to comment
Share on other sites

I'd hoped there was an easy way. :) But, after some playing with the batch files, I've gotten it to work by modifying the Server_Start.bat file. I've also re-arranged it a bit, mainly to make it easier for me to tell what I was doing. I also added a line to the Close.bat file to shut down STunnel when the server shuts down. I'll post them here in case anyone is interested.



: Batch file to start the Uniform Server with STunnel
: Author: packrat
: Based on 'Server_Start.bat' by The Uniform Server Development Team

@echo off

rem use: start <driveletter> mysql console - to start mysql at server start and display console
rem use: start <driveletter> mysql - to start mysql at server start
rem use: start <driveletter> nomysql console - to display console

rem Check to see if Apache is already started
diskw\home\admin\program\pskill Apache.exe
IF NOT ERRORLEVEL 1 goto started

rem Create the virtual drive
set Disk=%1
IF "%Disk%"=="" set Disk=w
subst %Disk%: "diskw"
IF ERRORLEVEL 1 goto hint

rem Set some useful variables
set apachepath=\usr\local\apache2\
set apachecommand=%Disk%:%apachepath%bin\Apache.exe -f %apachepath%conf\httpd.conf -d %apachepath%.
set programpath=%Disk%:\home\admin\program\
set closecommand=%programpath%close.bat %Disk%
set www=\www\
set apanel=\home\admin\www\

rem Uncomment this line if you're using STunnel
set stunnelpath=%Disk%:\home\admin\Www\plugins\Stunnel-4.05\bin\

cd \usr\local\php
IF "%2"=="mysql" goto mysql
rem Uncomment this line if you're using STunnel
start %stunnelpath%stunnel-4.05 %stunnelpath%ssltunel.conf
echo The server is working on the disk %Disk%:\ [http/]
start %Disk%:%apanel%redirect.html
if "%3"=="console" goto console
start %programpath%uniserv.exe "%apachecommand%" "%closecommand%"
goto end

echo Error: Apache is already started. Use 'Stop.bat'
goto end

echo The drive letter %Disk% is already in use. Use 'Disk Start.vbs' [driveletter]
goto end

goto end

rem %Disk%:
rem cd \usr\local\php
start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf
goto startserver




@echo off
set Disk=%1
IF "%Disk%"=="" set Disk=w
%Disk%:\home\admin\program\pskill.exe mysqld-opt.exe
IF ERRORLEVEL 1 goto nomysql
%Disk%:\usr\local\mysql\bin\mysqladmin.exe --character-sets-dir="/usr/local/mysql/share/charsets/" --user=root --password=root shutdown
rem Shut down STunnel if it's running
%Disk%:\home\admin\program\pskill.exe stunnel-4.05.exe c
subst %Disk%: /D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...