I have 2 web servers running ISPconfig 3, first server is master, and second is set to be "Is mirror of Server" master. When creating cron jobs on the master server using ISPConfig, it appears these cron jobs are replicated across on the mirror. Hence our crons are run twice. e.g. I have a cron to hit a PHP script (URL cron), and the PHP script sends me an email. I get the email twice, because both the master and mirror server run the cron. How do I get the mirror server to not run crons? I only use the mirror server as a backup, and ISPConfig mirrors all the config, and I use rsync to mirror data.
No cron on mirror Hi Snowfly, The cron jobs give up-to-date information about whats happening on the mirror so IMO it's not a good idea not to have the cron jobs running. Maybe there is something you could do with your email script which prevents the mirror from sending you mail. If you still want to edit the cron jobs you can do this: As root on the mirror crontab -e select your editor (<----- most likely "vim") and you should see these 2 jobs: * * * * * /usr/local/ispconfig/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log 30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log You can comment them # to stop them from running.
Hi CSsab, No I do not mean the ISPConfig cron script. I am talking about user/client cron scripts. These are listed under /etc/cron.d/ For example, on my master server I have: /etc/cron.d/ispc_web26 And on my mirror server I also have: /etc/cron.d/ispc_web26 And both contain the same (where URL is my PHP script): */5 * * * * web26 /usr/bin/wget -q -O /dev/null '<URL>' >/dev/null 2>&1 So the PHP script gets run twice, and I get to emails sent to me, because at the bottom of the PHP script I put a php mail(...) command. So wanting to know a way to stop user/client cron jobs getting replicated and run on the mirror server.
You can exclude a file, files and an entire directory using the: $ rsync -avz --exclude command. So you could either exclude anything in etc/cron.d/ or the entire directory etc/cron.d from being backed up on the mirror. Did you use a guide to set up rsync? If so which one?
Sorry you still misunderstand my problem. This has nothing to do with rsync. This is to do with internal ISPConfig functionality. In ISPConfig I have configured my backup server to Mirror the master server. This is done under: System > Server Services > {click on backup server} > Select option "Is mirror of Server" > {select master server from drop down box} With this setting, every action I submit on my ISPConfig control panel for the master server, is replicated / mirrored on the backup server. e.g. - I create a web domain on master server, web domain settings (not content) is mirrored on backup server - I create an FTP user on master server, FTP user is mirrored on backup server And when I create a client cron job on the master server (Under Sites > Cron Jobs > Add new Cron Job) This cron job is replicated on the backup server. ISPConfig itself creates the cron job on the master server at: /etc/cron.d/ispc_web26 And ISPConfig on the backup server creates the cron job on the backup server: /etc/cron.d/ispc_web26 Make sense?
Yes I understand what you mean - sorry about the confusion. I only use the mirror function for DNS - that is to say, my ns2 is a mirror of ns1 and those two are not used for anything else. I would use rsync to back up everything else. Have you tried doing something like this: On the slave as root: cp /etc/cron.d/ispc_web26 /etc/cron.d/ispc_web26.ORIG rm /etc/cron.d/ispc_web26 vi /etc/cron.d/ispc_web26 ## put something here... save and close file chmod -x /etc/cron.d/ispc_web26 The mirror function on the master may not be able to overwrite the file then. But maybe there would be errors.
That wouldn't work, as its only stopping one specific cron, not multiple crons. Any cron I setup on master is also setup on backup (mirror) So every cron is run twice. Must be a way to stop this?
Hi, I realise this is an old thread but the problem still exists and this is one of the first results that shows up on Google, I imagine this solution may help others. I hope it's ok to post it here. If you only need users' crons on the master server, not on the slave, you can simply create an alternative directory for ISPConfig to create users' cron files, and update the slave's config accordingly: On the ISPC Dashboard : System > Server Config > *Select your slave server* Then in the "Cron" tab, change the value of "Path for individual crontabs" to something like this: /etc/cron.ispc On your slave server: Create the folder to avoid errors: mkdir /etc/cron.ispc And if you want to do some cleanup of what's already installed on the slave, simply type: rm /etc/cron.d/ispc_*