9.5. Adding a New Action

If you have a command that you want run at boot time, creating a new action script is the best way to set it up. Servers like Apache or Qmail that have been compiled and installed manually do not have actions, so you will need to create one that runs whatever command is necessary to start the server.

To create your own action, follow these steps:

1.
On the main page of the module, click the Create a new bootup and shutdown action link above or below the list of existing actions. This will take you to the form shown in Figure 9.3 for entering the code for your new action script.

Figure 9.3. The action creation form.


2.
In the Name field, enter a short name for the action like qmail. Every action must have a unique name.

3.
In the Description field, enter a few lines of text to describe your action—maybe something like Start the Qmail mail server. This will show up on the main page of the module under the Description column.

4.
The Bootup commands field must be filled in with the shell commands that you want to run when your action is started at boot time. For example, if you wanted to start Qmail you might enter /var/qmail/rc.

5.
The Shutdown commands field should be filled in with commands that you want to run when your action is stopped. For example, to stop Qmail you might enter killall –9 qmail-send.

6.
Assuming you want your action to run at boot time, set the Start at boot time? option to Yes.

7.
Finally, click the Create button to save the new action. Webmin will create a script in the /etc/rc.d/init.d directory combining the commands you entered with a standard wrapper to make a valid action script. Your action will be set to run in the current runlevel, with order number 99 so that it is run last. If you want to control exactly which runlevels and in what order your action is run, see the Allow selection of individual runlevels option in Section 9.7 “Configuring the Bootup and Shutdown Module”.

After an action has been created, you can edit the start and stop commands by following this process:

1.
On the main page of the module, click on the name of your action. This will take you to the action editing form shown in Figure 9.2.

2.
In the Action script text box, look for a line like 'start'). The commands that are run at boot time will come after it, down to the a line containing just ;;. Edit them as you wish, but leave the surrounding code alone.

Similarly, the commands that are run when the action is stopped are between 'stop') and ;;. Changing any other part of the script is a bad idea unless you know what you are doing.

3.
Click the Save button to apply your changes.

Any of the existing action scripts can be edited using Webmin, not just your own creations. Be careful editing them, as they may have a format totally different to the scripts created by Webmin.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.218.84