{"id":268,"date":"2012-03-07T18:21:52","date_gmt":"2012-03-07T06:21:52","guid":{"rendered":"http:\/\/mdickinson.dnsalias.org\/php\/wordpress\/?p=268"},"modified":"2012-03-07T18:21:52","modified_gmt":"2012-03-07T06:21:52","slug":"automatically-starting-turnkey3-windows7","status":"publish","type":"post","link":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/?p=268","title":{"rendered":"Automatically starting turnkey3 &#8211; Windows7"},"content":{"rendered":"<p>I had a need to do this, and this is my solution for running a &#8220;live&#8221; hercules system running turnkey3 from either a USB stick or a DVD image.<\/p>\n<p>The only difference between the two is that if the .bat file detects it is running from a DVD or CDROM it will use a config using C:\\TEMP for disk shadow files, print, punch and log files (and be unable to use tapes), if run from a USB it will use the USB for all its work files, and not use the host disk at all.<\/p>\n<p>The filesystem includes the native windows hercules programs, wc3270 (the windows port of x3270), a turnkey3 system, and of course an autorun.inf to start hercules\/telnet\/3270 screens. Exactly the same filesystem for both media.<\/p>\n<p>You will notice all the config pastes are from a unix server :-), thats my environment. I have already<br \/>\ndocumented <a href=\"https:\/\/mdickinson.dyndns.org\/hercules\/downloads\/initd\/initd.php\"><br \/>\nhow to automatically start hercules and TK3 on a headless linux server<\/a>, this post is how to do it on windows.<\/p>\n<p>My directory layout is as below, just hercules, wc3270 and turnkey3<\/p>\n<pre>\r\n[mark@phoenix USB DISK]$ find .\/ -type d\r\n.\/                                     <-- the autorun.inf covered below\r\n.\/hercules\r\n.\/hercules\/wc3270                      <== wc3270\r\n.\/hercules\/wc3270\/html\r\n.\/hercules\/hercules-3.05               <== windows hercules\r\n.\/hercules\/hercules-3.05\/html\r\n.\/hercules\/hercules-3.05\/html\/Images\r\n.\/hercules\/hercules-3.05\/html\/include\r\n.\/hercules\/hercules-3.05\/util\r\n.\/hercules\/turnkey3                    <== copy of a working tk3 system\r\n.\/hercules\/turnkey3\/conf\r\n.\/hercules\/turnkey3\/daemons\r\n.\/hercules\/turnkey3\/dasd\r\n.\/hercules\/turnkey3\/jcl\r\n.\/hercules\/turnkey3\/log\r\n.\/hercules\/turnkey3\/pch\r\n.\/hercules\/turnkey3\/prt\r\n.\/hercules\/turnkey3\/shadow             \r\n.\/hercules\/turnkey3\/standalone\r\n.\/hercules\/turnkey3\/supplied\r\n.\/hercules\/turnkey3\/supplied\/jcl\r\n.\/hercules\/turnkey3\/supplied\/scripts\r\n.\/hercules\/turnkey3\/tapes\r\n[mark@phoenix USB DISK]$\r\n<\/pre>\n<p>One important thing to note is that I have created a \/hercules\/turnkey3\/hercules.rc to do the IPL; as I wanted a totally hands off startup. The hercules.rc file just contains<\/p>\n<p>[mark@phoenix turnkey3]$ cat hercules.rc<\/p>\n<pre>\r\npause 20\r\nipl 148\r\n<\/pre>\n<p>As Windows7 doesn't allow autorun for USB media (I believe it still does for CD media) I chose to just use an AutoPlay configuration which should work on both. In the USB or CD root directory my autorun.ing file is as below<\/p>\n<pre>\r\n[mark@phoenix USB DISK]$ cat autorun.inf\r\n[AutoRun]\r\n; Volume and icon to be displayed\r\nlabel=\"MVS38J\"\r\nicon=\\hercules\\hercules-3.05\\hercules.exe,0\r\n; run this program\r\nshellexecute=\\hercules\\autostart.bat\r\nUseAutoPlay=1\r\n; the below shows in first line of autoplay menu, describe shellexecute\r\naction=Run Hercules (MVS38J)\r\n; the below options appear when drive letter is right clicked\r\nshell\\runherc\\command=\\hercules\\autostart.bat\r\nshell\\runherc=Run Hercules (MVS38J)\r\n; the bolw is invoked when drive letter is double clicked, runs the above\r\nshell=runherc\r\n[IgnoreContentPaths]\r\n\\hercules\\wc3270\r\n\\hercules\\MVS38J\r\n<\/pre>\n<p>All the work is in the batch file that gets run when it is selected by AutoPlay via one of the methods in the autorun.inf, and the contents of that are as below<\/p>\n<p>[mark@phoenix hercules]$ cat autostart.bat<br \/>\n@ECHO OFF<br \/>\nREM ###################################################<br \/>\nREM Autostart script.<br \/>\nREM Do our best to autorun the MVS3.8J system<br \/>\nREM<br \/>\nREM (1) Change the PATH to point to the hercules and<br \/>\nREM     wc3270 files<br \/>\nREM (2) Try and work out if we are running off a cdrom<br \/>\nREM     (which would autorun) or a USB\/external disk<br \/>\nREM     as if a cdrom we cannot write to it so must<br \/>\nREM     use a different config that will use C:\\temp<br \/>\nREM (3) Work out what windoze version we are running<br \/>\nREM     under. The START command won't work before XP<br \/>\nREM     I'm still not sure the batch commands used<br \/>\nREM     will work under XP, but say we won't run under<br \/>\nREM     anything prior to XP and hope XP works<br \/>\nREM (4) start hercules, and wait for 5 seconds for it<br \/>\nREM     to initialise<br \/>\nREM (5) start the telnet and 3270 sessions needed<br \/>\nREM (6) show the what to do next<br \/>\nREM ###################################################<\/p>\n<p>REM We need to use a different config file if this is on a CDROM<br \/>\nREM as we can't write to the CDROM for the shadow files.<br \/>\nset mydrive=%~dp0%<br \/>\nset mydrive2=%mydrive:~0,3%<br \/>\nreg query hklm\\system\\mounteddevices|findstr \/C:\"5C003F00\"|findstr \/C:\"DosDevices\\%mydrive2%\"<br \/>\nIF %ERRORLEVEL% EQU 0 goto iscdrom<br \/>\nSET config=\"conf\\marks.conf\"<br \/>\ngoto checkver<br \/>\n:iscdrom<br \/>\nSET config=\"conf\\marks_cdrom.conf\"<br \/>\nECHO \"Detected this is running from CDROM, will use C:\\TEMP for shadow disks\"<br \/>\nECHO \"N O T E :  Tapes are not shadowed, so any tape write operations will fail on livecd\"<br \/>\nECHO \"\"<br \/>\nECHO \"B E F O R E    P R O C E E D I N G\"<br \/>\nECHO \"\"<br \/>\nECHO \"Please check you have a C:\\TEMP directory, create if needed.\"<br \/>\nECHO \"Windowze 7 doesn't seem to have one by default, and the live CDROM will crash without it\"<br \/>\nECHO \"Hit enter when you have confirmed you have a C:\\TEMP directory for disk shadow files\"<br \/>\nECHO \"--> shadow files are used for disk writes needed when the 'master' disk images are\"<br \/>\nECHO \"    write protected (ie: paging space must be writeable which isn't possible to cdrom)\"<br \/>\nECHO \"    and are simply a record of changes made...\"<br \/>\nECHO \"  ...deleting them will restore the system to the supplied state, however leaving the\"<br \/>\nECHO \"   shadow files in C:\\TEMP will let you start hercules off the cdrom again with all\"<br \/>\nECHO \"   changes you have made preserved, until you clean temp at some point anyway :-)\"<br \/>\nPAUSE<\/p>\n<p>REM ----------------------------------------<br \/>\nREM Check Windows Version<br \/>\nREM ----------------------------------------<br \/>\n:checkver<br \/>\nver | findstr \/i \"5\\.0\\.\" > nul<br \/>\nIF %ERRORLEVEL% EQU 0 goto ver_2000<br \/>\nver | findstr \/i \"5\\.1\\.\" > nul<br \/>\nIF %ERRORLEVEL% EQU 0 goto ver_XP<br \/>\nver | findstr \/i \"5\\.2\\.\" > nul<br \/>\nIF %ERRORLEVEL% EQU 0 goto ver_2003<br \/>\nREM BOTH VISTA AND WIN2008 RETURN 6.0.nnn<br \/>\nver | findstr \/i \"6\\.0\\.\" > nul<br \/>\nIF %ERRORLEVEL% EQU 0 goto ver_Vista<br \/>\nver | findstr \/i \"6\\.1\\.\" > nul<br \/>\nIF %ERRORLEVEL% EQU 0 goto ver_Win7<br \/>\ngoto warn_and_exit<\/p>\n<p>REM -------------------------------------------<br \/>\nREM Windows 7, Vista and XP command section<br \/>\nREM -------------------------------------------<br \/>\n:ver_Win7<br \/>\n:ver_vista<br \/>\n:ver_XP<br \/>\nREM The below should work from WinXP up<br \/>\nSET batpath=%~dp0<br \/>\nPATH=%batpath%hercules-3.05;%batpath%wc3270<br \/>\nECHO \"Starting hardware console\"<br \/>\nSTART \"hwcons\" \/D %batpath%turnkey3 \/MIN \/SEPARATE \/NORMAL hercules.exe -f %config%<br \/>\nREM ECHO \"Wait about five seconds then hit enter\"<br \/>\nREM pause<br \/>\nECHO \"Starting hardcopy, master console, alternate console and one tso session\"<br \/>\nSTART \"hdcopy\" \/SEPERATE \/NORMAL telnet localhost 3270<br \/>\nSTART \"mastcnsl\" \/SEPARATE \/NORMAL wc3270 -allbold localhost:3270<br \/>\nSTART \"altcnsl\" \/SEPARATE \/NORMAL wc3270 -allbold localhost:3270<br \/>\nSTART \"tso1\" \/SEPARATE \/NORMAL wc3270 -allbold localhost:3270<br \/>\nECHO \"-----> Hit enter on the mastcnsl window that prompts for options to start the system <------\"\nECHO \"note: if you have changed system exits before ipl'ing use R00,CLPA instead of enter\"\nECHO \"...and thats it, you are running\"\nECHO \"   users available for tso\"\nECHO \"      (admin) mark and sysprog, password mvs38j\"\nECHO \"      (guest) guest1 thru guest5, password guest\"\nECHO \"Enjoy.\"\ngoto end\n\nREM -------------------------------------------\nREM Windows Server 2003, WinXP and Win2000\nREM command section\nREM -------------------------------------------\n:ver_2003\n:ver_2000\necho \"The autorun script is not supported for Windoze Server 2003 or Windows 2000\"\ngoto end\n\n:warn_and_exit\necho Machine OS cannot be determined.\n\n:end\n\nNote that the above bat file uses a different configuartion file if it detects it is running from a CD\/DVD, which as noted earlier has the only differences of moving the location of anything that will be written to (excluding tapes) to C:\\TEMP for CD\/DVD as obviously that media is unwriteable.\n\nI won't show the actual hercules configuration files used here, there is enough info on how to use those on the many hercules sites on the internet; this post is just on how to make it a \"live\" media image.\n\n<b><br \/>\nA few important notes.<br \/>\n<\/b><\/p>\n<ul>\n<li>while on Win7 pro the autoplay menu appears, on win7 home premium where I have disabled autoplay even a right click<br \/>\nwon't show the hercules option. In which case you will just have to manually click on hercules\/autostart.bat to get up<br \/>\nand running<\/li>\n<li>If when the system starts you have a device interrupt on device 009, you either do not have telnet enabled on your PC<br \/>\nor its a stupid windows thing. If you have telnet enabled start a cmd prompt and \"telnet localhost 3270\" and the<br \/>\ninterupt will clear (or you can ignore it until the message buffers fill up); on win7 home premium it won't start<br \/>\nfrom the autostart.bat file, on Win7 prfessional it will; I don't care thats why I use Linux<\/li>\n<\/ul>\n<p>But basically thats it. However \/hercules\/autorun.bat gets triggered you will have a running hercules TK3 system<br \/>\nwith three 3270 sessions and (if enabled) a telnet session connected for you to play with.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a need to do this, and this is my solution for running a &#8220;live&#8221; hercules system running turnkey3 from either a USB stick or a DVD image. The only difference between the two is that if the .bat &hellip; <a href=\"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/?p=268\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-mvs38j-on-hercules"],"_links":{"self":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":4,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":272,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions\/272"}],"wp:attachment":[{"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mdickinson.dyndns.org\/php\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}