DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-11-26 05:06:17

ottsm
Member
Registered: 2010-12-23
Posts: 44

How to prevent multiple cron jobs or stop cron jobs

Started a cron job that is setup to sync both hard drives on a 323 every 24 hours.  I put a new drive in and now it is going to take more then 24 hours given the size of the drives.  What is going to happen, is it going to start another rsync that is going to run in parallel, or is it going to wait for the first rsync to complete?

Should I stop the cron job, if so, how do you stop a cron job? Not sure cron stop will work and if it does will it kill the file jobs that are transferring during the kill process or do I need to worry about the last few files being corrupt.

Offline

 

#2 2011-11-26 12:18:50

scaramanga
Member
Registered: 2010-08-04
Posts: 251

Re: How to prevent multiple cron jobs or stop cron jobs

Unless you did something yourself to make sure there won't be two jobs running at the same time, you'll get two jobs running at the same time.
You should temporarily stop the cron job till the first one finishes.


DNS-323 HW Rev. C1 FW 1.10 fun-plug 0.5
2 x WD10EARS-00Y5B1 in Standard mode (LCC set to 5 min; Aligned to 4K)
Transmission with Transmission Remote GUI

Offline

 

#3 2011-11-26 17:06:30

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: How to prevent multiple cron jobs or stop cron jobs

Run "crontab -e" to load the cron jobs into the editor. Insert a hash "#" before the one you want to disable. Remove it again later to re-enable the job.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#4 2011-11-26 19:29:28

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: How to prevent multiple cron jobs or stop cron jobs

The problem is the cron job is still running, if I edit the cron while it's running will it stop the job?

Offline

 

#5 2011-11-26 19:59:17

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: How to prevent multiple cron jobs or stop cron jobs

No, it won't stop the running job, it will stop another one from starting.

If you want to stop the current job, then run 'ps -ef' to see the running processes. You can type 'kill -9 <pid>' and insert the appropriate process id of the job you want to stop...... or just let it finish on its own.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#6 2011-11-26 21:23:45

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: How to prevent multiple cron jobs or stop cron jobs

Only run another rsync if there isnt one running already.

#!/bin/bash

RESULT=$(ps -ef | egrep 'rsync' | grep -v grep )

if [ -z "$RESULT" ] ; then

  rsync   bla bla  ;

fi

Offline

 

#7 2011-11-27 15:53:30

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: How to prevent multiple cron jobs or stop cron jobs

Thanks for the info, like the idea of adding the additional script commands to avoid this problem.  I have both a 325 and 323 with 1tb and 2tb drives. I installed a new backup drive and forgot how long this can take, over 1.5 days for the 323 and 5gb.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB