Posted on
of 42
First Prev
/ 42
  • Cheers all for the assistance.

    It looks like I have a few issues. First one is that the full command wasn't being executed for some reason so however I tried to log it I wasn't getting any output. The command actually being executed was this :

    Oct  2 13:50:01 raspberrypi CRON[5184]: (root) CMD (sh /home/pi/bkup_rpimage/ start -c /media/Raspi/Backup/$(date +)

    Should stuff be in quotes or something? I've not seen any reference to that before.

    When I shorten down the output so the command does run I get the following error in my log file

    /home/pi/bkup_rpimage/ 299: /home/pi/bkup_rpimage/ blockdev: not found
    /home/pi/bkup_rpimage/ 300: /home/pi/bkup_rpimage/ blockdev: not found
    /home/pi/bkup_rpimage/ 352: /home/pi/bkup_rpimage/ losetup: not found
    /home/pi/bkup_rpimage/ 360: /home/pi/bkup_rpimage/ losetup: not found
    -e Required program losetup is not installed

    Not sure why it runs when I run it directly but not using cron. I can't find any reference to it from googling the script.

  • Scripts run from cron aren't inheriting your interactive shell setup, and often have a different PATH. You can find the absolute path of each of the programs it's complaining about by typing eg.

    $ which blockdev

    in your shell, and then use the result (/sbin/blockdev or whatever it happens to be) explicitly in the script. Or just add that directory to PATH inside the script.

  • Excellent, thanks all. That's got it working now.

    Now just need to work out why cron doesn't work with the command which includes the date.

    EDIT: Turns out I needed to escape the + and % with a backslash

  • I have an annoying issue that I keep bumping into that I suspect has a simple solution (I'm guessing I screwed something up somewhere).

    I have a number of folders on a Windows machine mounted using /etc/fstab. Generally all works fine but every so often they don't all mount properly (I suspect it's when I've had a powercut or similar and the linux machine boots up before the windows one).

    Linux machine auto-downloads various stuff and uses those mounted folders to save it to the network. When the mount isn't working it just saves the files to the raspberry pi (the same folder that is normally mounted) and swiftly fills up the SD card. How do I stop this happening? Downloading is generally happening on sabnzbd

  • You could make the directory read-only on the underlying FS, so the write will always fail unless the mount has succeeded.

  • That sounds like it should work. Will give it a try. Cheers.

  • I posted this in the Pi thread, but just incase:

    for those using pihole if your update "breaks" and complains iproute2 is missing

    check /etc/apt/sources.list and make sure it's right... mine was zero'd somehow, and iproute2 is now in backports for Debian Buster.

    If you want the real tech info, I filed my findings (and suggestions) here:­3537
    ... guess my username ... :P

  • snap can fuck right off, can't it.

  • I do miss being able to run df without having to grep out all the snaps.

    I understand the attraction of packaging apps up like the Mac .dmg style, though.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview


Posted by Avatar for hael @hael