linux - Multiple crontabs needed -
so have looked solution everywhere , never got answer.
how make multiple crontabs? running scripts interfere , 110% sure if able run multiple crontabs solve issue. (yeah tried everything). can perhaps make multiple users each have own crontab? , crontabs run @ same time?
thanks!
there's no exclusivity inherent in multiple crontabs. if 2 separate crontabs each run script every monday @ 4am, cron run both scripts more or less @ same time, on mondays @ 4am.
at guess, need locking, 1 or other of interfering scripts runs @ time. flock(1)
convenient tool use in shell scripts.
#!/bin/bash exec 3> /path/to/lock flock 3 # useful here exit 0 # releases lock
the above acquires advisory lock, or waits until lock freed , acquires it. try once without waiting, can following:
#!/bin/bash exec 3> /path/to/lock flock -n 3 || exit 1
Comments
Post a Comment