System commands inside awk

In one of my past article I explained how to pass a shell variable to an awk program. In this article I am explaining how to execute system commands inside awk.
I am explaining the same via an example. Suppose we have a cPanel server in which you want to list all email accounts mentioned in .contactemail file in each user’s home directory.

Selective cPanel backup script – Part2

In the first part of Selective cPanel back up script, I explained the script for taking cPanel backups of domains to local server. In this part I am going to explain my script for taking back up to a remote server via scp. For sake of undestanging I am using two terms namely backup server and backup client to explain the working of script. Backup server means the system[server] to which the backup of selected domains are to be stored and backup client means the system [server] which is sending backup to backup server.

In this client – server system I devised a script on backup server which needs to put in cron. This script calls the scripts which placed in the backup clients for sending cpanel backup via SCP by SSH.

Working of the script in more detail:

Backup-Client

Files :

/root/bkp.sh
/root/cred

Continue reading “Selective cPanel backup script – Part2”

Selective cPanel backup script – Part1

I don’t want to do different things but want to do things differently.

In this series of “Selective cPanel backup script” I am interested to demonstrate my local cPanel backup script before you. This script took backup of some specified domains using cPanel’s pkgacct script. I wrote this script for my client as he need to take backups of certain domains in different way than other domains on the server. These domains are huge sized and if it included in the regular cpbackup it will took about 6 days to complete. He have a weekly backup system. There are about 8 such domains.

Requirements:

1. Exclude 8 domains [hugesize] from regular weekly backup.

2. Distribute the backup of 8 those domains for entire month in such a way that on first week any two of those eight domains and second week another two of six domains and so on.

The first requirement can be satisfied with /etc/cpbackup-userskip.conf. For the second requirement we need to have a custom script.
Continue reading “Selective cPanel backup script – Part1”

Regenerating /etc/userdomains file

Note: If any existing /etc/userdomains file in the server, delete or move it first before executing following scripts.
/usr/local/cpanel/bin/userdata_update and then run /scripts/updateuserdomains

cPanel has many scripts in /usr/local/cpanel/bin/ directory. The following script will help you to regenerate /etc/userdomains file.

Continue reading “Regenerating /etc/userdomains file”

List out the users under a reseller account in cPanel Servers

Every one familiar with cPanel knows who a “reseller” is. Usually a reseller user has users under his authority. We can find out those users who are under a reseller user from “Show Reseller Account” menu in cPanel.

Since I loved CLI very much and want to do things from CLI as much as possible, I devised a simple script which makes an easy way to find the same.
Continue reading “List out the users under a reseller account in cPanel Servers”

Changing FTP password of all accounts in a cPanel server.

There is a cPanel script [chpass] to reset each user’s password. Its syntax is as follows

/scripts/chpass <username> <password>

After running the script always run the following script

/scripts/ftpupdate

Using the above cPanel script I have created my own script to change all users password in one shot.

Script:

Continue reading “Changing FTP password of all accounts in a cPanel server.”

Compile apache with suPHP module [cPanel]

suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.

suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.

Continue reading “Compile apache with suPHP module [cPanel]”

The maximum each domain can send out per hour and cPanel

Its quite well known to all that in server’s WHM, there is an option that allows you to set the Maximum amount of emails a domain can send per hour, which is a great way of reducing spam/mass emailing. This feature is located in the Server Configuration option, under Tweak Settings option, under the emails listing. The option looks like as follows:

Continue reading “The maximum each domain can send out per hour and cPanel”