cron - syncthing: unrecognized service

Hi all,

I use “service syncthing restart” in my ubuntu console successfully.

However, it doesn’t work in crontab.

14 * * * * service syncthing restart

I receive error:

syncthing: unrecognized service

Please advise.

Starting at the other end, why do you want to restart Syncthing every hour? That doesn’t seem like something you’re supposed to want to do.

(I don’t know the cause of the error, but I would start by investigating that the crontab runs as the same user as you expect and so on.)

1 Like

Ok, syncthing doesn’t start automatically on some of my linux computers. Don’t know why. I must type “sudo service syncthing start” in console after pc reboot. Yes, I do not need to restart it every hour in real life. I just set it to see what will be error message.

What do you suggest to ensure it starts automatically after reboot?

The included systemd units seem to work fine for people running that, myself I use runit on non-systemd setups.

Just a guess here, since I don’t run ubuntu.

Try giving the complete path to service e.g.

14 * * * * /usr/bin/service syncthing restart

or wherever service lives.

Arne Ko,

14 * * * * /usr/bin/service syncthing restart

Still doesn’t work,

got error message:

syncthing: unrecognized service

Any other suggestions please?

Can you run service syncthing restart yourself - take cron out of the picture.

Using monit to monitor syncthing.

This is part of my /etc/monit/monitrc file:

check process syncthing matching "syncthing" start program = "/usr/bin/service syncthing start" stop program = "/usr/bin/service syncthing stop" if cpu usage > 95% for 10 cycles then restart

Will see how it does work.

You didn’t answer my question. Can you run service syncthing restart yourself, manually?

Sorry, did not think it was question, because did not see “?” symbol in your sentence. Yes, I do can run sudo service syncthing restart (only with sudo). This is what it says when I try to run it without sudo:

stop: Unknown task: syncthing start: Unknown task: syncthing

OK, that sounds like the same issue as when you run it with cron? What user is cron running as?

cron is running as root

$ ps -fC cron


root 1292 1 0 june06 ? 00:00:01 cron

And are you editing root’s crontab, or the crontab for your user?

I tried both,

crontab -e


sudo crontab -e

and both return the same error message:

syncthing: unrecognized service

Be aware that sudo retains some of your environment, which may be affecting things here. Try:

$ su
$ whoami
$ service syncthing restart
$ crontab -e

$ su


root@pc:/home/user1# whoami


root@pc:/home/user1# service syncthing restart

stop: unrecognized service: syncthing

start: unrecognized service: syncthing

root@pc:/home/user1# crontab -e

Got the same error from cron:

syncthing: unrecognized service

I’ve no idea what’s going on, then. It’s nothing to do with Syncthing though

ok, as long as monit shows syncthing status and should start it when it doesn’t start automatically. Will see.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.