Files
PSOPNSenseAPI/docs/cmdlets/Set-OPNSenseCronJob.md
T

4.7 KiB

Set-OPNSenseCronJob

SYNOPSIS

Modifies an existing cron job on an OPNSense firewall.

SYNTAX

Set-OPNSenseCronJob -UUID <String> [-Minutes <String>] [-Hours <String>] [-Days <String>] [-Months <String>]
                    [-Weekdays <String>] [-Command <String>] [-Description <String>] [-Enabled <Boolean>] [-WhatIf] [-Confirm]

DESCRIPTION

The Set-OPNSenseCronJob cmdlet modifies an existing cron job on an OPNSense firewall.

EXAMPLES

Example 1: Modify a cron job description

Set-OPNSenseCronJob -UUID "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Description "Updated Backup Job"

This example updates the description of an existing cron job.

Example 2: Change the schedule of a cron job

Set-OPNSenseCronJob -UUID "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Hours "3" -Minutes "30"

This example changes the schedule of an existing cron job to run at 3:30 AM.

Example 3: Disable a cron job

Set-OPNSenseCronJob -UUID "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Enabled $false

This example disables an existing cron job.

PARAMETERS

-UUID

The UUID of the cron job to modify.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Minutes

The minutes field of the cron job (0-59, *, */5, etc.).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Hours

The hours field of the cron job (0-23, *, */2, etc.).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Days

The days field of the cron job (1-31, *, */2, etc.).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Months

The months field of the cron job (1-12, *, */2, etc.).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Weekdays

The weekdays field of the cron job (0-7, *, etc., where 0 and 7 are Sunday).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Command

The command to execute.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

A description for the cron job.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Enabled

Whether the cron job is enabled.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

You can pipe a string containing the UUID of a cron job to this cmdlet.

OUTPUTS

System.Object

Returns an object representing the modified cron job.

NOTES

This cmdlet requires a connection to an OPNSense firewall. Use Connect-OPNSense to establish a connection. The cron job time fields use standard cron syntax:

    • means all values
  • */n means every n values
  • n-m means values from n to m
  • n,m means values n and m

Get-OPNSenseCronJob New-OPNSenseCronJob Remove-OPNSenseCronJob Enable-OPNSenseCronJob Disable-OPNSenseCronJob