Make Domain Keys
05-24-2010 @ 5:21AM EDT
This is a very simple bash script that will generate domain keys for each domain on your server. Domain keys are used by some e-mail providers (such as Yahoo Mail and GMail) to reduce spam by checking for these keys that verify an e-mail is coming from the correct server.
How to use it:
If you don't already have a mydir folder then create one (mkdir /mydir). Then copy and paste the code into a new mkdomainkeys.sh file in the /mydir folder (vi /mydir/mkdomainkeys.sh). Don't forget to set your permissions to make the file executable (chmod 0771 /mydir/mkdomainkeys.sh). Now you can copy and paste the following line into your crontab (type crontab -e after you SSH into your server):
1 0 * * * /mydir/mkdomainkeys.sh 2>&1 > /dev/null
The above line will run the script every morning at 1AM and will not generate an e-mail.
You can adjust the time but this normally takes a few seconds to run so there is little to no impact on your CPU load.
A breakdown of this script:
#!/bin/bash <- Tells the server to run this script with the BASH interpreter.
for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done <- Finds each username in the /var/cpanel/users directory and runs the domain_keys_installer for each.
Code:
#!/bin/bash
for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done
for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done
servers, scripts, tutorials, linux, email
Comments
This article hasn't been commented yet.


Write a comment
* = required field