[ (Click here).]

[Previous]
The OS/2 Project
 [Next]

If you're looking for interesting and innovative ways to take advantage of OS/2's power, or if you just want a neat trick to impress you're friends, this is the place to look! "The OS/2 Project" chronicles small endeavours intended to improve our systems, make us more productive and just generally make our lives easier.

A few issues ago, we answered a question in "Answers from e-Zine! " about setting a default boot partition in Boot Manager. Our somewhat cumbersome solution prompted many readers to suggest we try the incredibly useful "SETBOOT" utility instead. We did, and we found that SETBOOT is good for a lot more than just setting a default boot partition.

In this issue, we take a look at how to create Desktop objects to automatically shutdown and reboot to different partitions.

* * *

Purpose

Many OS/2 users are adventurous souls and we often have many operating systems on our computers. While some people seek out more robust multi-OS management tools such as Power Boot, many install Boot Manager by default. After all, it's free and OS/2's installation does it practically automatically.

When we want to leave OS/2 (temporarily, of course) for a quick round of the latest Win95 gee-whiz game, or to tinker with Linux, we just shut down OS/2, hit Ctrl-Alt-Del, wait for Boot Manager to pop-up, highlight our desired OS and press Enter. It couldn't be easier, right?

Actually, it could be a lot easier. Win95 has a few options on its shutdown menu, including "Reboot", which bypasses the Ctrl-Alt-Del and Boot Manager selection stages, immediately rebooting to Windows. Since we are somewhat more intelligent than Microsoft's engineers, we realize that we may want to automatically reboot to an OS other than the one we are using. Our Desktop objects will allow us, with a single selection, to shut down OS/2 and reboot to any other partition on our system, bypassing Boot Manager.

What You Will Need

As an added bonus this month, you do not need to download anything. Everything required for this project comes included with OS/2, so you're already almost finished! We will be using the program "SETBOOT.EXE", some command files, a few program objects and optionally, the WarpCenter (for those using Warp 4).

Setting It Up

First we should explain what SETBOOT does. SETBOOT can be used to query and set various properties of OS/2's Boot Manager. Opening an OS/2 Command window and typing SETBOOT without any options will give a terse list of available switches. Typing:

   Help SETBOOT
will provide all the details you want, and probably more. (Note: all command line entries are case insensitive. Typing 'SETBOOT' is equivalent to typing 'setboot'.) To summarize, SETBOOT can query the current settings of Boot Manager; it can set or remove Boot Manager defaults; and it can be used to shut down and reboot OS/2, either using or bypassing the Boot Manager selection process.

The option we are interested in is:

   SETBOOT /IBA:n
Here 'n' refers to a partition name which has been set in Boot Manager. (FDISK requires you to enter names for partitions when you add them to the Boot Manager menu. If you want to be able to autoboot to a partition not already listed in your Boot Manager menu, you must add it to Boot Manager with FDISK before following the rest of these instructions.)

Assuming you have a partition named "Warp 4" in Boot Manager, the command:

   SETBOOT /IBA:"Warp 4"
will perform a shutdown of the WPS, flush the file-system buffers and caches and then restart your computer, booting automatically to the partition named "Warp 4" without ever pausing at the Boot Manager menu. Note that if there are spaces in the name of your partition, the quotation marks above are required. If you have partitions named Win95, Linux, DOS, and WinNT, the respective commands to reboot to each of them would be:
   SETBOOT /IBA:"Win95"
   SETBOOT /IBA:"Linux"
   SETBOOT /IBA:"DOS"
   SETBOOT /IBA:"WinNT"
Since the above partition names do not have spaces in them, the quotation marks are not required, but I've included them here just to be consistent. Remember to substitute the names you gave the partitions on your hard drives, if they differ.

In reality, that is the guts of our project this month. However, rather than remember a command line to be typed every time we want to reboot, we'll add a touch of elegance to this project.

Let's assume we want to reboot to a version of Linux which is on a partition labelled as "Linux" in Boot Manager. Start by creating a plain text file called LINUX.CMD with any OS/2 text editor. The file should contain only one line:

   SETBOOT /IBA:"Linux"
Save this command file and place it wherever is convenient for you -- it does not have to reside in your path.

Next, create a new program object by opening your "Templates" folder (found in your "OS/2 System" folder, which is on the OS/2 Desktop by default) and dragging the "Program" template object to the Desktop. Enter the path and file name of your OS/2 command file (GIF, 5.3k) in the "Path and file name" entry field on the "Program" tab. Close the Properties notebook.

Leave the new object on your Desktop and whenever you want to reboot to Linux, just double click on it. OS/2 will shut itself down and reboot directly to Linux, bypassing the Boot Manager menu. Naturally, you will want to make a separate object for each operating system you have listed in Boot Manager. You can leave all these objects on your Desktop or stick them in a folder to keep them organized.

[Folder Graphic]

Optional Steps for WarpCenter Users

[WarpCenter Graphic]If you use the WarpCenter, you can add your folder containing the "reboot objects" to a WarpCenter tray. What I did is:

  1. create a folder and name it "Reboot to..."
  2. put the objects to reboot to my various OSs in that folder
  3. put the folder in a folder that is shadowed on my WarpCenter

Now I have a handy menu from which I can reboot to different OSs.

Some Other Customizations

You can also add your "reboot objects" to the pop-up menu you get by right-clicking on the Desktop. To do this:

  1. Right-click on the Desktop and select "Properties" to bring up its Properties notebook.

  2. Click on the "Menu" tab.

  3. Click on the "Create Another..." button next to the "Available menus" list to bring up the "Menu Properties" dialog.

  4. Type "Reboot to..." in the "Menu Name" entry field and leave the "Menu type" selection as "Cascade menu". Click "Ok" to save.

  5. Now make sure that your "Reboot to..." menu item is highlighted in the "Available menus" list. Look below the "Available menus" list and you should see "Actions on menu: Reboot to..." with a blank window below it. Click on the "Create another..." button next to this blank window to bring up the "Menu item properties" dialog.

    [Menu Item Properties Dialog]

  6. In the "Menu item name" field, type the name of the operating system that this menu item will boot when selected. For the sake of illustration, let's say it will be Linux.

  7. Assuming you have already created a script called E:\Scripts\Linux.cmd with the proper SETBOOT command in it, in the "Program" section's "Name" entry field type the full path to your script, e.g. E:\Scripts\Linux.cmd. Press "Ok".

  8. Repeat steps 6 and 7 for each operating system in your Boot Manager menu. When complete, your Desktop Properties notebook should look something like this:

    [Completed Desktop Propertied notebook]

  9. Close the Desktop Properties window.

[Finished Pop-up Menu]Now when you right-click on the Desktop, you will see a "Reboot To..." entry in the menu near the bottom. Click on the arrow to the right of this entry and you will see your list of operating systems. Selecting one of those will cause the "reboot object" to be executed.

Also, you may want to make your rebooting scripts, use REXX to ask if you really want to reboot. Instead of the one line reboot commands above, use:

   /* Reboot to Warp */
   Say "Do you want to reboot to Warp?"
   Say
   Pull A
   If A="Y" then 'SETBOOT /IBA:"Warp 4"'
This way, errant clicks can be caught to avoid accident shutdowns.

Things to Remember

If you don't use the REXX tip above, be careful where you place your "reboot objects". You will not want to activate them accidentally. SETBOOT does flush your system's buffers and perform an "orderly reboot". However, just as with the normal "Shutdown" function of OS/2, programs you have open may be closed without saving your data.

On the positive side of things, you may find these "reboot objects" useful in some situations where OS/2 will not shut down. Occasionally, OS/2 will attempt to shut down but not complete the task. Repeated attempts to shut down the Desktop will have no effect. In these cases, I have found that SETBOOT sometimes is able to shut down the system. In reality, this is really no different than using Ctrl-Alt-Del when the Desktop refuses to shut down. SETBOOT is not a substitute for a good program killing utility.

That's it. Enjoy!

* * *

If you have questions or suggestions for improvements to this project, let us know. Until then, enjoy!


[Previous]
 [Index]
 [Feedback]
 [Next]

[Our Sponsor: Indelible Blue - OS/2 software and hardware solutions to customers worldwide.]

Copyright © 1998 - Falcon Networking ISSN 1203-5696