Oily Rag 1: CD Part 1: Difference between revisions
Jump to navigation
Jump to search
m
Reverted edits by Upazixorys (Talk); changed back to last version by Ric
Upazixorys (talk | contribs) No edit summary |
m (Reverted edits by Upazixorys (Talk); changed back to last version by Ric) |
||
Line 1: | Line 1: | ||
{{Uc nav oily rag 1 CD}} | {{Uc nav oily rag 1 CD}} | ||
'''Uniform Server 3.5-Apollo running from a CD''' | '''Uniform Server 3.5-Apollo running from a CD''' | ||
Line 37: | Line 36: | ||
Make the following changes to '''httpd.conf''' located in '''*\udrive\usr\local\apache2\conf''' first save the original to folder (Uniform Server/uscd) and name it old_httpd.conf. | Make the following changes to '''httpd.conf''' located in '''*\udrive\usr\local\apache2\conf''' first save the original to folder (Uniform Server/uscd) and name it old_httpd.conf. | ||
{|cellpadding= | {|cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style= | |-style="background:#cccccc" | ||
!Line | !Line | ||
!Action | !Action | ||
!Comment | !Comment | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
83 | 83 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
PidFile logs/httpd.pid | PidFile logs/httpd.pid<br> | ||
'''PidFile c:/us35temp/apache/logs/httpd.pid''' | '''PidFile c:/us35temp/apache/logs/httpd.pid''' | ||
|-style= | |-style="background:#f5f5f5" | ||
|valign= | |valign="top"| | ||
457 | 457 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
ErrorLog logs/error.log | ErrorLog logs/error.log<br> | ||
'''ErrorLog c:/us35temp/apache/logs/error.log''' | '''ErrorLog c:/us35temp/apache/logs/error.log''' | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
483 | 483 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
CustomLog logs/access.log combined | CustomLog logs/access.log combined<br> | ||
'''#CustomLog logs/access.log combined''' | '''#CustomLog logs/access.log combined''' | ||
|} | |} | ||
Line 86: | Line 85: | ||
'''''Note'':''' The chances are you will not see the file extension .cnf, don’t worry about it, for some reason Windows likes to hide this. | '''''Note'':''' The chances are you will not see the file extension .cnf, don’t worry about it, for some reason Windows likes to hide this. | ||
{|cellpadding= | {|cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style= | |-style="background:#cccccc" | ||
!Line | !Line | ||
!Action | !Action | ||
!Comment | !Comment | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
35 | 35 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
datadir = | datadir = "/usr/local/mysql/data/"<br> | ||
'''datadir = | '''datadir = "c:/us35temp/mysql/data/"''' | ||
|-style= | |-style="background:#f5f5f5" | ||
|valign= | |valign="top"| | ||
36 | 36 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
tmpdir = | tmpdir = "/tmp"<br> | ||
'''tmpdir = | '''tmpdir = "c:/us35temp/mysql/tmp"''' | ||
|} | |} | ||
After making the changes copy my-small.cnf to folder (Uniform Server/uscd) and name it '''new_my-small.cnf''' | After making the changes copy my-small.cnf to folder (Uniform Server/uscd) and name it '''new_my-small.cnf''' | ||
Line 118: | Line 117: | ||
Make the following changes to '''php.ini''' located in '''*\udrive\usr\local\php''' first save the original to folder (Uniform Server/uscd) and name it old_php.ini. | Make the following changes to '''php.ini''' located in '''*\udrive\usr\local\php''' first save the original to folder (Uniform Server/uscd) and name it old_php.ini. | ||
{|cellpadding= | {|cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style= | |-style="background:#cccccc" | ||
!Line | !Line | ||
!Action | !Action | ||
!Comment | !Comment | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
348 | 348 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
error_log = logs/logs.log | error_log = logs/logs.log<br> | ||
'''error_log = c:/us35temp/php/logs/logs.log''' | '''error_log = c:/us35temp/php/logs/logs.log''' | ||
|-style= | |-style="background:#f5f5f5" | ||
|valign= | |valign="top"| | ||
499 | 499 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
upload_tmp_dir = /tmp | upload_tmp_dir = /tmp<br> | ||
'''upload_tmp_dir = c:/us35temp/php/tmp''' | '''upload_tmp_dir = c:/us35temp/php/tmp''' | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
884 | 884 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
session.save_path = | session.save_path = "/tmp"<br> | ||
'''session.save_path = | '''session.save_path = "c:/us35temp/php/tmp"''' | ||
|} | |} | ||
After making the changes copy php.ini to folder (Uniform Server/uscd) and name it '''new_php.ini''' | After making the changes copy php.ini to folder (Uniform Server/uscd) and name it '''new_php.ini''' | ||
Line 159: | Line 158: | ||
Make the following changes to '''config.inc.php''' located in '''*\udrive\home\admin\www\phpMyAdmin''' first save the original to folder (Uniform Server/uscd) and name it old_config.inc.php . | Make the following changes to '''config.inc.php''' located in '''*\udrive\home\admin\www\phpMyAdmin''' first save the original to folder (Uniform Server/uscd) and name it old_config.inc.php . | ||
{|cellpadding= | {|cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style= | |-style="background:#cccccc" | ||
!Line | !Line | ||
!Action | !Action | ||
!Comment | !Comment | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
449 | 449 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
$cfg['UploadDir'] = '/etc/phpmyadmin'; | $cfg['UploadDir'] = '/etc/phpmyadmin'; <br> | ||
'''$cfg['UploadDir'] = 'c:/us35temp/phpmyadmin/etc/phpmyadmin';''' | '''$cfg['UploadDir'] = 'c:/us35temp/phpmyadmin/etc/phpmyadmin';''' | ||
|-style= | |-style="background:#f5f5f5" | ||
|valign= | |valign="top"| | ||
452 | 452 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
$cfg['SaveDir'] = '/etc/phpmyadmin'; | $cfg['SaveDir'] = '/etc/phpmyadmin';<br> | ||
$cfg['SaveDir'] = 'c:/us35temp/phpmyadmin/etc/phpmyadmin'; | $cfg['SaveDir'] = 'c:/us35temp/phpmyadmin/etc/phpmyadmin'; | ||
|-style= | |-style="background:#e6e6e6" | ||
|valign= | |valign="top"| | ||
458 | 458 | ||
|align= | |align="right"| | ||
Change from: | Change from:<br> | ||
To: | To: | ||
| | | | ||
$cfg['TempDir'] = '/tmp'; | $cfg['TempDir'] = '/tmp';<br> | ||
'''$cfg['TempDir'] = 'c:/us35temp/phpmyadmin/tmp';''' | '''$cfg['TempDir'] = 'c:/us35temp/phpmyadmin/tmp';''' | ||
|} | |} | ||
Line 201: | Line 200: | ||
Obviously no changes are required for standard operation however some modification are needed to run from a CD. When run; our new Server_Start.bat needs to perform some additional tasks: | Obviously no changes are required for standard operation however some modification are needed to run from a CD. When run; our new Server_Start.bat needs to perform some additional tasks: | ||
:* '''Create''' folder c:\us35temp and any sub-folders | :* '''Create''' folder c:\us35temp and any sub-folders<br> | ||
:: (This caters for both MySQL and Apache, Apache needs nothing else it will happily create the necessary files here) | :: (This caters for both MySQL and Apache, Apache needs nothing else it will happily create the necessary files here) | ||
:* '''Copy''' the entire data (database) from MySQL | :* '''Copy''' the entire data (database) from MySQL<br> | ||
:: (The only thing of importance files copied from a CD will have their read attribute set to avoid this potential problem use xcopy.) | :: (The only thing of importance files copied from a CD will have their read attribute set to avoid this potential problem use xcopy.) | ||
Line 214: | Line 213: | ||
Below I have provided a detailed description of the new commands added to Server_Start.bat. These are placed towards the top of the file. | Below I have provided a detailed description of the new commands added to Server_Start.bat. These are placed towards the top of the file. | ||
{|cellspacing= | {|cellspacing="0" cellpadding="4" | ||
|-style= | |-style="background:#f5f5f5" | ||
|set ustemp=c:\us35temp | |set ustemp=c:\us35temp | ||
|Using the '''set''' command a variable '''ustemp''' is created its value is the complete path c:\us35temp to our temporary file on the c drive. To use this variable in a batch file it is contained between two % symbols. | |Using the '''set''' command a variable '''ustemp''' is created its value is the complete path c:\us35temp to our temporary file on the c drive. To use this variable in a batch file it is contained between two % symbols. | ||
|-style= | |-style="background:#e6e6e6" | ||
|IF NOT EXIST %ustemp% md %ustemp% | |IF NOT EXIST %ustemp% md %ustemp% | ||
|When the batch file is run it checks to see '''if''' the folder already '''exist'''s on the c drive if not it '''m'''akes a ''d'''rive (folder) defined by our variable %ustemp% | |When the batch file is run it checks to see '''if''' the folder already '''exist'''s on the c drive if not it '''m'''akes a ''d'''rive (folder) defined by our variable %ustemp% | ||
|-style= | |-style="background:#f5f5f5" | ||
|IF NOT EXIST %ustemp% goto :ABORT | |IF NOT EXIST %ustemp% goto :ABORT | ||
|Because this folder is so important we check to see if it was created. If it does not exist we jump to the line named :ABORT and start running code from there. If it exists continue to execute next line of code. | |Because this folder is so important we check to see if it was created. If it does not exist we jump to the line named :ABORT and start running code from there. If it exists continue to execute next line of code. | ||
|-style= | |-style="background:#e6e6e6" | ||
|Several sub-folders are now created. | |Several sub-folders are now created. | ||
|For sub-folders the process is similar, create and check. | |For sub-folders the process is similar, create and check. | ||
|-style= | |-style="background:#f5f5f5" | ||
|XCOPY& | |XCOPY "%CD%\udrive\usr\local\mysql\data" %ustemp%\data\ /s /q<br><br>Note: Any path that contains a space '''MUST''' be enclosed in quotes. | ||
|XCOPY is a powerful command its general syntax is '''XCOPY& | |XCOPY is a powerful command its general syntax is '''XCOPY source destination switches'''<br>'''Source:''' We want to copy everything in the MySQL data folder, including sub-folders hence the switch<strong> /s</strong> Windows likes to have a complete path (relative paths are a problem). This batch file can be placed anywhere, to find anywhere we use the variable '''%CD%''' current directory (folder) this is created automatically when this batch file is run. It's the complete path up to and including the folder name. | ||
'''Destination:''' Complete path to the folder where the database is to be copied, %ustemp%\data\ gives '''c:\us35temp\data\''' without the ending back slash Windows can not decide if its a folder or file hence that back slash is needed. | '''Destination:''' Complete path to the folder where the database is to be copied, %ustemp%\data\ gives '''c:\us35temp\data\''' without the ending back slash Windows can not decide if its a folder or file hence that back slash is needed. | ||
'''Switches:''' I have covered '''/s''' which forces all sub-folders and their content to be copied. Unless you like to see rows upon rows of commands flashing by make sure you add a '''/q''' switch this stands for quite mode and stops all this unwanted information. | '''Switches:''' I have covered '''/s''' which forces all sub-folders and their content to be copied. Unless you like to see rows upon rows of commands flashing by make sure you add a '''/q''' switch this stands for quite mode and stops all this unwanted information. | ||
|-style= | |-style="background:#f5f5f5" | ||
|goto :CONTINUE | |goto :CONTINUE | ||
|Jump pass the next few lines and resume at the line named :CONTINUE | |Jump pass the next few lines and resume at the line named :CONTINUE | ||
|-style= | |-style="background:#e6e6e6" | ||
|:ABORT | |:ABORT | ||
|A line or location where you can jump to using the | |A line or location where you can jump to using the <strong>go to</strong> command in this case our abort section, we found an error so give up. | ||
|-style= | |-style="background:#f5f5f5" | ||
|echo Sorry the folder %ustemp% or one of its sub-folders could not be created. | |echo Sorry the folder %ustemp% or one of its sub-folders could not be created.<br> echo Can not continue hence aborting<br>pause<br>EXIT | ||
|A few lines that we echo back to a user informing why we are given up. To give that person a chance to read the message pause halts the program and waits for a key to be pressed. At that point the EXIT command is executed and the batch file terminates. | |A few lines that we echo back to a user informing why we are given up. To give that person a chance to read the message pause halts the program and waits for a key to be pressed. At that point the EXIT command is executed and the batch file terminates. | ||
|-style= | |-style="background:#e6e6e6" | ||
|:CONTINUE | |:CONTINUE | ||
|A line or location where you can jump to using the '''go to''' command in this case our new lines of code are complete and appear to be working hence continue to run Uniserver batch file | |A line or location where you can jump to using the '''go to''' command in this case our new lines of code are complete and appear to be working hence continue to run Uniserver batch file | ||
Line 250: | Line 249: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
==== new_Server_Start.bat ==== | ==== new_Server_Start.bat ==== | ||
<pre> | |||
rem File Name: new_Server_Start.bat | rem File Name: new_Server_Start.bat | ||
rem Location: Uniform Server | rem Location: Uniform Server | ||
Line 310: | Line 309: | ||
:Copy complete database | :Copy complete database | ||
XCOPY | XCOPY "%CD%\udrive\usr\local\mysql\data" %ustemp%\mysql\data\ /s /q | ||
goto :CONTINUE | goto :CONTINUE | ||
Line 331: | Line 330: | ||
rem ### Apache not running. Check for drive letter if not set (%1) use default. | rem ### Apache not running. Check for drive letter if not set (%1) use default. | ||
set Disk=%1 | set Disk=%1 | ||
if | if "%Disk%"=="" set Disk=w | ||
rem ### Create the virtual disk, if it fails go to Hint | rem ### Create the virtual disk, if it fails go to Hint | ||
subst %Disk%: | subst %Disk%: "udrive" | ||
if errorlevel 1 goto :HINT | if errorlevel 1 goto :HINT | ||
Line 352: | Line 351: | ||
rem ### Start Apache server | rem ### Start Apache server | ||
start %programit%uniserv.exe | start %programit%uniserv.exe "%apacheit%" "%closeit%" | ||
rem ### Start Apanel | rem ### Start Apanel | ||
Line 358: | Line 357: | ||
rem ### Start MySQL server - skip if requested not to start (%2) | rem ### Start MySQL server - skip if requested not to start (%2) | ||
if | if "%2"=="nomysql" goto :NOMYSQL | ||
start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf | start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf | ||
:NOMYSQL | :NOMYSQL | ||
rem ### Does user want to run a command prompt, if not END | rem ### Does user want to run a command prompt, if not END | ||
if | if "%3"=="console" goto :CONSOLE | ||
goto :END | goto :END | ||
Line 391: | Line 390: | ||
rem restore original working directory | rem restore original working directory | ||
popd | popd | ||
</pre> | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 404: | Line 403: | ||
Below I have provided a detailed description of the new commands added to Stop.bat. These are placed at the end of the file. | Below I have provided a detailed description of the new commands added to Stop.bat. These are placed at the end of the file. | ||
{|cellpadding= | {|cellpadding="4" cellspacing="0" | ||
|-style= | |-style="background:#f5f5f5" | ||
|ping -n 20 localhost & | |ping -n 20 localhost > nul | ||
|This line serves no other purpose than to introduce a delay. Our temporary folder cannot be deleted until process using it terminate. I have found no way of detecting when a process ends from a batch file and then continue to the next command. Hence this little kludge delays for a certain time in the hope the processes have terminated before attempting to delete the folder. A last resort is to run stop.bat again, not elegant but works. Results returned from ping are dumped to the black hole file named nul. | |This line serves no other purpose than to introduce a delay. Our temporary folder cannot be deleted until process using it terminate. I have found no way of detecting when a process ends from a batch file and then continue to the next command. Hence this little kludge delays for a certain time in the hope the processes have terminated before attempting to delete the folder. A last resort is to run stop.bat again, not elegant but works. Results returned from ping are dumped to the black hole file named nul. | ||
'''-n count''' Number of echo requests to send | '''-n count''' Number of echo requests to send | ||
|-style= | |-style="background:#e6e6e6" | ||
|RMDIR& | |RMDIR /s /q c:\us35tempset | ||
|'''RMDIR''' Remove directory (deletes a named folder) we provide the full path to that folder. | |'''RMDIR''' Remove directory (deletes a named folder) we provide the full path to that folder.<br>'''Switches:''' There are two switches without '''/s''' you are requested to confirm each sub-folder deletion. Quite mode is enable by '''/q''' this prevents the display of every deletion. | ||
|} | |} | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
==== new_Stop.bat ==== | ==== new_Stop.bat ==== | ||
<pre> | |||
rem File Name: new_Sop.bat | rem File Name: new_Sop.bat | ||
rem Location: Uniform Server | rem Location: Uniform Server | ||
Line 450: | Line 449: | ||
rem otherwise RMDIR fails and the bat must be re-run | rem otherwise RMDIR fails and the bat must be re-run | ||
echo Please Wait removing files | echo Please Wait removing files | ||
ping -n 15 localhost | ping -n 15 localhost > nul | ||
:clean up remove dir | :clean up remove dir | ||
RMDIR /s /q c:\us35temp | RMDIR /s /q c:\us35temp | ||
Line 456: | Line 455: | ||
rem restore original working directory | rem restore original working directory | ||
popd | popd | ||
</pre> | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' |