• [6.7.0-rc3] Remove cron entries when array is stopped?


    dlandon
    • Closed Minor

    When the array is stopped there are cron entries that could be problematic.  When the array is stopped the following is in the crontab and /etc/cron.d/root.

    # If you don't want the output of a cron job mailed to you, you have to direct
    # any output to /dev/null.  We'll do this here since these jobs should run
    # properly on a newly installed system.  If a script fails, run-parts will
    # mail a notice to root.
    #
    # Run the hourly, daily, weekly, and monthly cron jobs.
    # Jobs that need different timing may be entered into the crontab as before,
    # but most really don't need greater granularity than this.  If the exact
    # times of the hourly, daily, weekly, and monthly cron jobs do not suit your
    # needs, feel free to adjust them.
    #
    # Run hourly cron jobs at 47 minutes after the hour:
    47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
    #
    # Run daily cron jobs at 4:40 every day:
    40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
    #
    # Run weekly cron jobs at 4:30 on the first day of the week:
    30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
    #
    # Run monthly cron jobs at 4:20 on the first day of the month:
    20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null

     

    # Generated docker monitoring schedule:
    10 0 * * 1 /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerupdate.php check &> /dev/null
    
    # Generated system monitoring schedule:
    */1 * * * * /usr/local/emhttp/plugins/dynamix/scripts/monitor &> /dev/null
    
    # Generated parity check schedule:
    0 9 1 * * /usr/local/sbin/mdcmd check  &> /dev/null || :
    
    # Generated plugins version check schedule:
    10 0 * * * /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugincheck &> /dev/null
    
    # Generated unRAID OS update check schedule:
    11 0 * * * /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/unraidcheck &> /dev/null
    
    # Generated ssd trim schedule:
    30 5 * * * /sbin/fstrim -a -v | logger &> /dev/null

    I don't know if any of these items running while the array is stopped would cause any issues.  If the timing was right during a shutdown, I could see come issues.

    • Upvote 1



    User Feedback

    Recommended Comments

    Looks like it's been like that forever.

     

    Personally though, for any custom cronjobs I add in via a plugin, I check to see if the array is running before the script executes.

     

    Don't know if the built-in scripts perform that operation if they require a running array

    Link to comment

    The implementation of the cron jobs hasn't changed since the introduction of Unraid v6.

     

    If any dependency on the array status, it is the responsibility of the script to take care of it.

    None of the scripts as part of the stock GUI cause an issue when the array is stopped.

     

    Link to comment
    On 2/13/2019 at 2:22 PM, Squid said:

    Looks like it's been like that forever.

     

    Personally though, for any custom cronjobs I add in via a plugin, I check to see if the array is running before the script executes.

     

    Don't know if the built-in scripts perform that operation if they require a running array

    May i ask how you check if array is running, and also, if array want to stop, does it also return "array stopped"?

     

    Because i have custom scripts which i also dont want to run while array is goin to stop or is stopped.

    Link to comment
    21 minutes ago, nuhll said:

    May i ask how you check if array is running, and also, if array want to stop, does it also return "array stopped"?

     

    Because i have custom scripts which i also dont want to run while array is goin to stop or is stopped.

    Easy way for a script is if /mnt/user doesn't exist then the array is stopped   for a plugin, different methods tend to be used via the UI's events

    Link to comment

    Im using user scripts, i dont know how i could do that.

     

    Is there a easy way to find out if the array wants to stop or is stopped? Bc check for mnt user will only return false if its already stopped.

    Link to comment
    33 minutes ago, nuhll said:

    Im using user scripts, i dont know how i could do that.

    The cron entries are removed by the user scripts plugin when the array is stopped.  It's not a problem.

    Link to comment

    If it werent a problem, i wouldnt ask for a solution... :)

     

    I run a rclone upload script and fuse mount for google drive.

     

    Both stop the array from a clean shutdown, sometimes, atleast.

     

    I would like to add something to my scripts to prevent them stopping unraids "array stop" process.

    Link to comment

    The best way to get an answer it to post in the user scripts plugin forum and someone will help you there.  This really isn't the place to get the help you need.

    Link to comment


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.