开发者

Ruby and systemd for ubuntu 20.04.64 problem

I have server with ubuntu 20.04.64 and i want to use "systemd" for demon my app.

I have my Ruby app (main.rb) in ho开发者_如何学JAVAme/demo/montenegrophotobot/Montenegro_Photo_bot_V1.0.36/main.rb

and have montenegrophotobot2.service in /etc/systemd/system

inside main.rb i don't have first line with #! because i write write way in service file

inside file.service

[Service]
ExecStart=/root/.rvm/rubies/ruby-2.7.2/bin/ruby /home/demo/montenegrophotobot/Montenegro_Photo_bot_V1.0.36/main.rb

both of this file are for the same user and are under

chmod +x

When i make

systemctl daemon-reload
systemctl start montenegrophotobot2
systemctl status montenegrophotobot2

i have this result

Dec 07 04:36:20 vm478453.vps.local systemd[1]: Started montenegrophotobot2.service.
Dec 07 04:36:20 vm478453.vps.local ruby[28049]: /root/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file > -- telegram/bot (LoadError)
Dec 07 04:36:20 vm478453.vps.local ruby[28049]:         from /root/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
Dec 07 04:36:20 vm478453.vps.local ruby[28049]:         from /home/demo/montenegrophotobot/Montenegro_Photo_bot_V1.0.36/main.rb:6:in `<main>'
Dec 07 04:36:20 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Main process exited, code=exited, status=1/FAILURE
Dec 07 04:36:20 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Failed with result 'exit-code'.

then

journalctl -f -u montenegrophotobot2

i have

-- Logs begin at Mon 2020-04-27 10:45:03 MSK. --
Dec 07 04:07:42 vm478453.vps.local ruby[24905]:         from /root/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
Dec 07 04:07:42 vm478453.vps.local ruby[24905]:         from /home/demo/montenegrophotobot/Montenegro_Photo_bot_V1.0.36/main.rb:6:in `<main>'
Dec 07 04:07:42 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Main process exited, code=exited, status=1/FAILURE
Dec 07 04:07:42 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Failed with result 'exit-code'.
Dec 07 04:36:20 vm478453.vps.local systemd[1]: Started montenegrophotobot2.service.
Dec 07 04:36:20 vm478453.vps.local ruby[28049]: /root/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file -- telegram/bot (LoadError)
Dec 07 04:36:20 vm478453.vps.local ruby[28049]:         from /root/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
Dec 07 04:36:20 vm478453.vps.local ruby[28049]:         from /home/demo/montenegrophotobot/Montenegro_Photo_bot_V1.0.36/main.rb:6:in `<main>'
Dec 07 04:36:20 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Main process exited, code=exited, status=1/FAILURE
Dec 07 04:36:20 vm478453.vps.local systemd[1]: montenegrophotobot2.service: Failed with result 'exit-code'.

So now i don't know how to fix it... Please help

I exactly know that all is ok with montenegrophotobot2.service , because i changed code inside main.rb to

print "Hello World"

and it was perfect without errors

also i instal telegram bot gem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜