Run the action for the current rc.d script, based on the settings of various shell variables. rc_cmd is extremely flexible, and allows fully functional rc.d scripts to be implemented in a small amount of shell code. For a given action, if the rc_${action} function is not defined, then a default function is provided by rc.subr. In addition actions can be disabled by setting the rc_${action} variable to “NO”. For example, if “rc_reload=NO” is set in the rc.d script, and rc_cmd is called for the reload action, an error will be raised. Similarly, the special variable rc_usercheck must be set to “NO” if the check action requires root privileges.
The action argument can be start, stop, reload, restart, or check:
check
-
Call rc_check. Return 0 if the daemon is running or 1 if it is not.
start
-
Check that the service is running by calling rc_check. If it's not running, call rc_pre if it exists, then rc_start.
stop
-
Check that the service is running by calling rc_check. If it is running, call rc_stop and wait up to 30 seconds for the daemon to properly shutdown. If successful, run rc_post if it exists.
restart
-
Run the action argument stop, then if successful run start.
reload
-
Check that the service is running by calling rc_check. If it is running, call rc_reload.