0

On Ubuntu 14.04.5 LTS I'm using a script to restart some services, when the TLS certificate that is being used is renewed. The script is run through root's crontab. Any change is TLS certificate triggers the commands to restart the services and activate the new certificate.

When the command service vsftpd restart is executed, cron daemon logs the following error: vsftpd: unrecognized service

Needless to say that service vsftpd restart works as expected when run on root's command line.

I also noticed that vsftpd does not appear in the list of services when running service --status-all

Crontab for root

14 7 * * * /root/vesta-server-ssl-cert.sh

Question: What is the correct command to be placed inside a script for restarting vsftpd service through root's crontab?

2
  • Can we see the vesta-server-ssl-cert.sh script's contents? Sep 7, 2017 at 7:00
  • And what does service vsftpd status say? Sep 7, 2017 at 7:03

1 Answer 1

0

I had the same problem with other services some time ago; resolved it by using initctl and didn't dig deeper to find out what was going on. So try:

/sbin/initctl restart vsftpd

it should work.

Oh, I hate these "this works, don't know why" answers, but that's all I have for the moment.

Edit: Ok, now I feel better. service is a shell script, and it needs to have /sbin in the PATH environment, otherwise it can't find stop and start binaries it maps "restart" to. Then it uses /etc/init.d/ script, which it can't find, so it reports "unrecognized service"

TomTomTom

1
  • Thank you! I confirm that the use of /sbin/initctl restart vsftpd works perfectly for me :) Sep 8, 2017 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .