Cron jobs on azure linux machines

Pratapagiri Kumar (Consultant) 20 Reputation points
2023-06-01T16:35:43.72+00:00

Hi Team, by using power shell how to run cron jobs on azure linux machines.Please let us know

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,068 questions
{count} votes

Accepted answer
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-06-01T16:41:40.31+00:00

    To run cron jobs on Azure Linux machines using PowerShell, you can use the Azure CLI (Command-Line Interface) along with the az vm run-command command.

    Here's a step-by-step guide:

    Install Azure CLI: If you haven't already, install the Azure CLI on your local machine. You can download and install it from the Azure CLI documentation: https://docs.microsoft.com/cli/azure/install-azure-cli

    Connect to your Azure account: Open a PowerShell session and sign in to your Azure account using the az login command. Follow the instructions to complete the authentication process.

    Get the VM resource group and name: Identify the resource group and virtual machine name where you want to run the cron job.

    1. Run the cron job command: Use the az vm run-command invoke command to run the cron job on the specified virtual machine. For example, if you want to run a cron job that echoes "Hello, World!" every minute, the command would be:
    az vm run-command invoke --resource-group myResourceGroup --name myVM --command-id RunShellScript --scripts 'echo "Hello, World!"'
    
    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Pratapagiri Kumar (Consultant) 20 Reputation points
    2023-07-04T05:54:21.79+00:00

    Hi Team,

    How to configure build agent with AKS,ACR and steps to configure for AKS cluster

    Thanks and Regards,

    Pranav

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.