Using Crontab on OMV - updated

  • Hello,


    This might be a borderline OMV issue since it is also linked to a programme I'm using.


    Parts of my OMV storage should be used as CCTV loop storage.

    So I'm using FFMPEG to capture the stream and direct / store it in segments on an OMV partition and created a crontab entry for it.


    FFMPEG has a bug in that it seems to ignore the -t / -timelimit option, so I wanted to kill and re-start the process periodically- via another crontab entry preceeding the re-start.


    However, the only way I can kill the process (tested manyally) is by using the process ID.

    Code
    killall ffmpeg

    does not work (nor does kill ffmpeg).


    Since the proces ID is dynamic, this won't work- unless there is another way to kill a process via crontab.


    Why would it not take the process name but only the ID?

  • Update:


    Code
    killall 15 ffmpeg

    did the trick to stop ffmpeg.

    I've now placed both commands (start & kill) in the crontab and am testing it.

    Perhaps one can re-start it with killall 1 , it remains to be seen.

  • GBano

    Changed the title of the thread from “Using Crontab on OMV” to “Using Crontab on OMV - updated”.
  • Another update:


    Logged in as a user (not root),

    crontab -e

    edited the crontab:

    Code
    00 10 20 9 * USER ffmpeg -loglevel debug -hide_banner -i 'http://videostreamIP' -y -f segment -segment_time 3600 -segment_format mp4 segment_wrap 3 -c copy /srv/path/to/file-%03d.mp4
    00 11 20 9 * USER killall 15 ffmpeg

    CTRL-X, save

    ...and wait: Nothing.


    If I execute both commands manually in the terminal, everything works.

    So the commands seem correct.


    But cron doesn't seem to work.


    Did I miss something here? Need to logon as root? Wrong crontab?

  • This might sound daft....

    '/usr/bin/ffmpeg' ? That's where I'd locate ffmpg.

    But I tried and it doesn't work.


    Here's another thing: Shouldn't 'crontab -e ' also show the existing cron job that I added via the GUI which does a backup from HDD1 to HDD2 and which is active and working?

    Can't see it anywhere there.

    But yes, I created this one as 'admin', so may be on admin/root level.

  • Here's another thing: Shouldn't 'crontab -e ' also show the existing cron job that I added via the GUI which does a backup from HDD1 to HDD2 and which is active and working?

    OMV does not use crontab. The jobs created in the GUI are executed via /etc/cron.d/openmediavault-rsync.

    The actual jobs are in /var/lib/openmediavault/cron.d/

  • This might sound daft....

    '/usr/bin/ffmpeg' ? That's where I'd locate ffmpg.

    But I tried and it doesn't work.

    Are you guessing where that file is or did you actually run find, locate, or which to get its path. Also, ffmepg is not in the OMV default install.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 5.x on Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 16GB ECC RAM.

  • Since executable binaries can be found in (usr)/bin I just searched this subdirectory and found ffmpeg.

    Yes, it was not part of the OEM setup, so I installed it.


    I can run the ffmpeg command manually from a user level. This made me assume it would work on the same level as a user-level cron job.

  • Update:


    I ran a very simple test command on this user-level 'crontab -e':


    cp /path/to/source/file.txt /path/to/destination/


    And it did nothing.


    My conclusion: It's not the way the command is called up.

    Must be something else...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!