LinuxCommandLibrary

func

Manage and interact with functions

TLDR

Create a new functions project

$ func init [project]
copy

Create a new function
$ func new
copy

Run functions locally
$ func start
copy

Publish your code to a function app in Azure
$ func azure functionapp publish [function]
copy

Download all settings from an existing function app
$ func azure functionapp fetch-app-settings [function]
copy

Get the connection string for a specific storage account
$ func azure storage fetch-connection-string [storage_account]
copy

SYNOPSIS

func [options] <target> <module>.<function> [arguments...]

PARAMETERS

--host=HOST_NAME
    Specifies a single host (by hostname or FQDN) to target for the command execution.

--group=GROUP_NAME
    Targets all hosts belonging to a specific group defined on the Spacewalk/Satellite server.

--all
    Executes the command on all systems managed by the connected Spacewalk/Satellite server.

--server=SERVER_URL
    Overrides the default Spacewalk/Satellite server URL to connect to a different one.

--config=FILE
    Specifies an alternative configuration file instead of the default /etc/spacewalk/func.conf or /etc/rhn/func.conf.

-v, --verbose
    Increases the verbosity of the output, providing more detailed information about the command execution.

-q, --quiet
    Suppresses output messages, showing only critical errors or results.

--force
    Forces the command execution, often bypassing checks or confirmations.

--dry-run
    Simulates the command execution without making any actual changes on the target systems.

--no-wait
    Executes the command and immediately returns without waiting for the results from the target systems.

DESCRIPTION

The func command, short for Fedora Unified Network Controller, is a powerful client-side utility primarily used in environments leveraging Red Hat Satellite or Spacewalk servers. Its core purpose is to facilitate centralized remote management of registered Linux systems.

It enables administrators to execute commands, retrieve system information, manage packages (install, update, remove), and perform various administrative tasks across a fleet of servers from a central point. func achieves this by communicating with the rhnmd (RHN Management Daemon) running on the target clients, leveraging a secure and robust infrastructure.

While not a general-purpose Linux command found on all distributions, func is indispensable in enterprise settings for automating tasks, ensuring compliance, and maintaining consistency across a large number of managed systems, significantly streamlining operational workflows.

CAVEATS

The func command requires that the target Linux systems are registered with a Spacewalk or Red Hat Satellite server and have the rhnmd daemon running and configured correctly. It is not a standalone utility for general Linux administration but rather an integral part of a larger, centralized system management infrastructure. Improper use, especially with the --all or --force options, can have widespread and unintended consequences across an entire managed fleet.

MODULE AND FUNCTION SYNTAX

The <module>.<function> syntax is crucial for func. Examples include package.install (to install packages), system.uptime (to get system uptime), file.read (to read file contents), or service.start (to start a service). The available modules and functions depend on the capabilities exposed by the rhnmd daemon and the Spacewalk/Satellite server.

CONFIGURATION FILES

func typically reads its configuration from /etc/spacewalk/func.conf or /etc/rhn/func.conf. These files define server URLs, proxy settings, and other communication parameters necessary for func to connect to the management server.

HISTORY

The func command emerged as part of Red Hat's efforts to provide centralized system management capabilities, initially within the Red Hat Network (RHN) tools. As RHN evolved into Spacewalk (the open-source upstream project) and subsequently Red Hat Satellite, func continued to be a core client-side utility for interacting with these management servers. Its development has focused on robust and scalable remote execution, adapting to new features and capabilities introduced in the server-side management platforms, making it a cornerstone for enterprise Linux administration.

SEE ALSO

rhnmd(8), rhn-client-tools(7), spacewalk-server(8), yum(8), dnf(8)

Copied to clipboard