【发布时间】:2016-11-26 08:50:15
【问题描述】:
我正在尝试在系统服务器启动/重新启动时使用 dotnet run --configuration Release 运行 dotnet 应用程序。我正在使用init.d 脚本来实现相同的目标。
我的启动脚本,位于/etc/init.d/myscript,包含以下内容:
#!/bin/sh
/home/user/myscripts/botScript.sh
botScript.sh的内容:
#!/bin/bash
cd /home/user/bot/
nohup dotnet run --configuration Release &
当我的服务器启动或重新启动时,启动脚本会被执行,但 dotnet run 不起作用。我收到以下错误:
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2, String path3)
at Microsoft.DotNet.ProjectModel.Resolution.PackageDependencyProvider.ResolvePackagesPath(String rootDirectory, GlobalSettings settings)
at Microsoft.DotNet.Configurer.NuGetCacheSentinel.get_NuGetCachePath()
at Microsoft.DotNet.Configurer.NuGetCacheSentinel.Exists()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.ShouldPrimeNugetCache()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
但所有其他命令在该脚本中都可以正常工作,甚至简单地运行dotnet 也可以正常工作(我已经检查过了)。只是dotnet run不行。
是的,但是当我运行脚本时,myscript 和 botScript.sh 在登录到我的服务器后,它工作正常,没有任何错误。
请问,谁能帮帮我?
【问题讨论】:
-
我不明白为什么它被否决了
-
顺便说一句,您是否收到警告“警告:未设置 HOME 环境变量。禁用 LTTng-UST 每用户跟踪。” ?
-
@Artiom 不,我刚刚收到上述错误。我还尝试分配
HOME环境。变量为/home/user仍然出现相同的错误。 -
您成功解决了这个问题吗?
标签: .net linux debian startup init