Run the AWS IoT Greengrass Core software - AWS IoT Greengrass

Run the AWS IoT Greengrass Core software

After you install the AWS IoT Greengrass Core software, run it to connect your device to AWS IoT Greengrass.

When you install the AWS IoT Greengrass Core software, you can specify whether to install it as a system service with systemd. If you choose this option, the installer runs the software for you and configures it to run when your device boots.

Important

On Windows core devices, you must set up the AWS IoT Greengrass Core software as a system service.

Check if the AWS IoT Greengrass Core software runs as a system service

When you install the AWS IoT Greengrass Core software, you can specify the --setup-system-service true argument to install the AWS IoT Greengrass Core software as a system service. Linux devices require the systemd init system to set up the AWS IoT Greengrass Core software as a system service. If you use this option, the installer runs the software for you and configures it to run when your device boots. The installer outputs the following message if it successfully installs the AWS IoT Greengrass Core software as a system service.

Successfully set up Nucleus as a system service

If you previously installed the AWS IoT Greengrass Core software and don't have the installer output, you can check if the software installed as a system service.

To check if the AWS IoT Greengrass Core software is installed as a system service
  • Run the following command to check the status of the Greengrass system service.

    Linux or Unix (systemd)
    sudo systemctl status greengrass.service

    The response looks similar to the following example if the AWS IoT Greengrass Core software is installed as a system service and active.

    ● greengrass.service - Greengrass Core Loaded: loaded (/etc/systemd/system/greengrass.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2021-02-11 01:33:44 UTC; 4 days ago Main PID: 16107 (sh) CGroup: /system.slice/greengrass.service ├─16107 /bin/sh /greengrass/v2/alts/current/distro/bin/loader └─16111 java -Dlog.store=FILE -Droot=/greengrass/v2 -jar /greengrass/v2/alts/current/distro/lib/Greengrass...

    If systemctl or greengrass.service isn't found, the AWS IoT Greengrass Core software isn't installed as a system service. To run the software, see Run the AWS IoT Greengrass Core software without a system service.

    Windows Command Prompt (CMD)
    sc query greengrass

    The response looks similar to the following example if the AWS IoT Greengrass Core software is installed as a Windows service and active.

    SERVICE_NAME: greengrass TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
    PowerShell
    Get-Service greengrass

    The response looks similar to the following example if the AWS IoT Greengrass Core software is installed as a Windows service and active.

    Status Name DisplayName ------ ---- ----------- Running greengrass greengrass

Run the AWS IoT Greengrass Core software as a system service

If the AWS IoT Greengrass Core software is installed as a system service, you can use the system service manager to start, stop, and manage the software. For more information, see Configure the Greengrass nucleus as a system service.

To run the AWS IoT Greengrass Core software
  • Run the following command to start the AWS IoT Greengrass Core software.

    Linux or Unix (systemd)
    sudo systemctl start greengrass.service
    Windows Command Prompt (CMD)
    sc start greengrass
    PowerShell
    Start-Service greengrass

Run the AWS IoT Greengrass Core software without a system service

On Linux core devices, if the AWS IoT Greengrass Core software isn't installed as a system service, you can run the software's loader script to run the software.

To run the AWS IoT Greengrass Core software without a system service
  • Run the following command to start the AWS IoT Greengrass Core software. If you run this command in a terminal, you must keep the terminal session open to keep the AWS IoT Greengrass Core software running.

    • Replace /greengrass/v2 or C:\greengrass\v2 with the Greengrass root folder that you use.

    sudo /greengrass/v2/alts/current/distro/bin/loader

    The software prints the following message if it launches successfully.

    Launched Nucleus successfully.