I need to set up 17 cron jobs as root, and I need them to run as often as possible (I'm moving an active site to a new server, and I'm copying over user-uploaded files from the old server to the new while waiting for the DNS to propagate).
AFAIK, this should work for one if I put it in /etc/crontabs:
This would make it run every 5 minutes. But is there a way for me to make it run one, wait 1 minute, then run the next? This way, I wouldn't be running two at once, and it would give it 1 minute for the CPU load to go down before moving on to the next.
FWIW, this would run for two weeks (max), at which time the old server goes offline permanently.
- - - Updated - - -
I don't have a lot of SH experience, but would this work?:
Then, since there would be 17 of these with a 30 second pause between (meaning a minimum of 8 1/2 minutes) set the cron to run the shell script every 10 minutes.
Is there an easier / better option?
AFAIK, this should work for one if I put it in /etc/crontabs:
Code:
*/5 * * * * root rsync -aupog -e 'ssh -p 1234' [email protected]:/home/old/public_html/dir/ /home/new/public_html/dir/
FWIW, this would run for two weeks (max), at which time the old server goes offline permanently.
- - - Updated - - -
I don't have a lot of SH experience, but would this work?:
Code:
#!/bin/sh
rsync -aupog -e 'ssh -p 1234' [email protected]:/home/old/public_html/dir1/ /home/new/public_html/dir1/
sleep 30
rsync -aupog -e 'ssh -p 1234' [email protected]:/home/old/public_html/dir2/ /home/new/public_html/dir2/
sleep 30
rsync -aupog -e 'ssh -p 1234' [email protected]:/home/old/public_html/dir3/ /home/new/public_html/dir3/
sleep 30
# and so on
Is there an easier / better option?