Adding Customized Commands to SAM

Prepared by Peggy Bruehl 4/30/97
In HP-UX 10.2, you can add your own customized commands to SAM. These custom commands can be configured just for the root SAM, or you can add them to the restricted SAM available to users on your system. (See the document Creating a Restricted SAM for details.) For example, you can configure SAM to mount and unmount the CD-ROM drive, or to restart the LDM.

In order to create customize SAM functions, you should first create a custom group, and then the custom menu items. As an example, I will create a custom function for mounting and unmounting a CD-ROM driver.

  1. As user root, start up SAM (/usr/sbin/sam).

  2. Use the Actions pull down menu and select Add Custom Application Group....

  3. This will pop up a window. Fill in the blanks. Only the Label is mandatory. Defaults will be used for the other two entries. For the Label, I type in CDROM, hit return, and press OK. (For some reason, SAM won't accept the hyphen in CD-ROM.)

  4. The CDROM icon should now appear in the SAM window. Double click on this icon. There are no actions in this window yet. We will add one now.

  5. Still in the CDROM area, use the Actions pull down menu and select Add Custom Application. This pops up a window. Again, fill in the blanks. For my example, I will type in Mount CDROM in the Label box, and /etc/mount /cdrom in the Command box. Use the full path to the mount command. (Of course, you must use the correct mount point for the CD-ROM on your system). Be sure to hit return after each box.

    You must now choose whether the command will execute as user root or as another user. In this case, only user root can mount and unmount the CD-ROM drive, so I must choose Root's ID. However, if I were running a different command that does not require user root, I could make a different choice. For example, if I were restarting the LDM, I would choose Specific User's ID, and type in user ldm.

    The User Interface option defines whether the command you've just specified has it's own graphical user interface or not. The mount command does not have a GUI, so I will select Terminal Environment. However, if you were configuring SAM to start NTL, then you would choose Graphical Environment.

    As before, the Help File and Icon Path are optional and can be left blank. Click on OK.

  6. Now the Mount CDROM icon should appear in the CDROM window. Next, repeat the previous step, but this time create an Unmount CDROM icon using the command /etc/umount /cdrom.

You may create as many customized SAM functions as you like. As mentioned earlier, you can create a set of LDM controls to start the LDM, stop the LDM, re-read the configuration file, check whether the LDM is running, clean up the LDM product queue file, remove the LDM lock file, etc. etc.

Remember, you may configure these SAM functions into the restricted SAM interface for users on your system. Simply follow the instructions in the document Creating a Restricted SAM for instructions.