1

I'm getting this error "/bin/sh: 1: fstrim: not found" from a cron job.

which seems to be this one and seems to be a default cron job shipped by ubuntu:

/etc/cron.weekly# cat fstrim 
#!/bin/sh
# trim all mounted file systems which support it
/sbin/fstrim --all || true

if i run that script directly i get no error and it seems to work fine :(

1

Works for me (just went and poked around too). Is it possible you somehow ended up with another cron job that's giving you that error and perhaps it's not /etc/cron.weekly/fstrim?

Where do you see that error?

You could try copying that script into /etc/cron.hourly and see if the error occurs every hour. The logs might explain more (/var/log/syslog).

It seems like it shouldn't be possible to get that error with the stock cron script if you can run it by hand and the fstrim command exists. All Ubuntu distributions are shipping with that script and probably Debian. It looks identical to mine.

  • damn, there was an other daily cron in /etc/cron.d/kernel which was probably added by the hosters xenial image.. will ask their support and most likely delete it ;) – kannix Aug 19 '16 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.