Search code examples
.net-corecronrhelrhel7software-collections

Running dotnet through cron on RedHat fails


We have a dotnet core script we use to index some files. We leverage RedHat Software Collection so items like dotnet can tie into our RHEL setup.

To run the script, we do the following: source scl_source enable rh-dotnet30 /opt/rh/rh-dotnet30/root/usr/bin/dotnet /d/h/fileprocessor.dll 1

We want to run this in cron, but we can not get it to work. We have tried the following:

  1. Adding the 'source' command to the bash profile, but this doesn't seem to be reliable for us, and not run on the cron event.
  2. Running this directly in cron
  3. Running this as a shell script in cron

We are at a loss, it seems we can never get the two commands to work together. If we don't include the source command, even if in our profile, it will not run and gives us the error " It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-download"


Solution

  • The issue we ran into for this was that the runtime had only been installed, and not the SDK. Once the SDK was installed, which included many other dependencies, it just worked.