Jekyll service is not working as systemd service

I have Jekyll installed into my CentOS 7 VPS. I want to run it as systemd service. So I have created a file called jekyll.service inside /etc/systemd/system/ folder with following content:


    [Service]
    User=arup
    Type=simple
    WorkingDirectory=/home/arup/blog/
    ExecStart=/usr/local/rvm/gems/ruby-2.6.3/bin/jekyll serve --watch --source "/home/arup/blog/"
    ExecStop=/usr/bin/pkill -f jekyll
    Restart=always
    TimeoutStartSec=60
    RestartSec=60
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=jekyll

    [Install]
    WantedBy=multi-user.target network-online.target

When I give following command:

 systemctl start jekyll 

It’s working with no error. But following Error arrives with systemctl status command:


```
* jekyll.service
   Loaded: loaded (/etc/systemd/system/jekyll.service; disabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2019-08-11 15:07:47 UTC; 49s ago
  Process: 2460 ExecStop=/usr/bin/pkill -f jekyll (code=exited, status=1/FAILURE)
  Process: 2459 ExecStart=/usr/local/rvm/gems/ruby-2.6.3/bin/jekyll serve --watch --source /home/arup/dbyll/ (code=exited, status=127)
 Main PID: 2459 (code=exited, status=127)

Aug 11 15:07:47 iamarup systemd[1]: Unit jekyll.service entered failed state.
Aug 11 15:07:47 iamarup systemd[1]: jekyll.service failed.

What’s wrong here? Can anybody pls help?

Thanks.

1 Like

I have same issue. If you have solved it. please help me

its probably a permissions error - but I am not at all familiar with your OS or systemd so I can’t help much.

Have you googled code=exited, status=127 to see what the error means? maybe add ruby or jekyll to that search.

i tried everything. its working fine when i run manually. failing as system service.

OS: Debian 11 bullyeye
Used RVM for installing ruby and dependencies.

Exact error:

/usr/local/rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe':
	can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)