linux的dbbus服务,请问做成linux(centos7)的服务怎么搞,想做成服务+自启,我试过,一直没搞起来,望指教...

```

[Unit]

Description=fastTunnel

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

ExecStart=/opt/FastTunnel.Client/FastTunnel.Client

ExecStop=/opt/FastTunnel.Client/stop.sh

PrivateTmp=true

[Install]

WantedBy=multi-user.target

```

systemctl start fastTunnel.service 报异常

```

[root@localhost FastTunnel.Client]# journalctl -xe

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at FastTunnel.Client.Program.Run(IServiceProvider servicesProvider)

4月 14 17:13:55 localhost.localdomain FastTunnel.Client[4503]: at FastTunnel.Client.Program.Main(String[] args)

4月 14 17:13:55 localhost.localdomain systemd[1]: fastTunnel.service: control process exited, code=killed status=6

4月 14 17:13:55 localhost.localdomain systemd[1]: Failed to start fastTunnel.

-- Subject: Unit fastTunnel.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit fastTunnel.service has failed.

--

-- The result is failed.

4月 14 17:13:55 localhost.localdomain systemd[1]: Unit fastTunnel.service entered failed state.

4月 14 17:13:55 localhost.localdomain systemd[1]: fastTunnel.service failed.

4月 14 17:13:55 localhost.localdomain polkitd[694]: Unregistered Authentication Agent for unix-process:4496:402885 (system bus name :1.61, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)

4月 14 17:15:20 localhost.localdomain polkitd[694]: Registered Authentication Agent for unix-process:4594:411530 (system bus name :1.62 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_C

4月 14 17:15:20 localhost.localdomain systemd[1]: Starting fastTunnel...

-- Subject: Unit fastTunnel.service has begun start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit fastTunnel.service has begun starting up.

4月 14 17:15:20 localhost.localdomain FastTunnel.Client[4600]: 2021/04/14 17:15:20.621|DEBUG|===== FastTunnel Client Start =====

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: 2021/04/14 17:15:21.472|ERROR|Stopped program because of exception Object reference not set to an instance of an object.

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at FastTunnel.Client.Program.implementationFactory(IServiceProvider arg)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProvider

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at FastTunnel.Client.Program.Run(IServiceProvider servicesProvider)

4月 14 17:15:21 localhost.localdomain FastTunnel.Client[4600]: at FastTunnel.Client.Program.Main(String[] args)

4月 14 17:15:21 localhost.localdomain systemd[1]: fastTunnel.service: control process exited, code=killed status=6

4月 14 17:15:21 localhost.localdomain systemd[1]: Failed to start fastTunnel.

-- Subject: Unit fastTunnel.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit fastTunnel.service has failed.

--

-- The result is failed.

4月 14 17:15:21 localhost.localdomain systemd[1]: Unit fastTunnel.service entered failed state.

4月 14 17:15:21 localhost.localdomain systemd[1]: fastTunnel.service failed.

4月 14 17:15:21 localhost.localdomain polkitd[694]: Unregistered Authentication Agent for unix-process:4594:411530 (system bus name :1.62, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)

4月 14 17:24:01 localhost.localdomain anacron[3815]: Job `cron.daily' started

4月 14 17:24:01 localhost.localdomain run-parts(/etc/cron.daily)[5066]: starting logrotate

4月 14 17:24:01 localhost.localdomain run-parts(/etc/cron.daily)[5071]: finished logrotate

4月 14 17:24:01 localhost.localdomain run-parts(/etc/cron.daily)[5073]: starting man-db.cron

4月 14 17:24:04 localhost.localdomain run-parts(/etc/cron.daily)[15101]: finished man-db.cron

4月 14 17:24:04 localhost.localdomain anacron[3815]: Job `cron.daily' terminated

lines 2289-2349/2349 (END)

```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值