Get count of files in each directory

Use: for i in `ls -1 .`; do echo -n $i „:  „; find $i|wc -l; done

Delete (really) many files in a directory

You may get an error with "rm", if really many files are deleted - like "arguments too long ..". Use this:

find . -maxdepth 1 -name '*.pdf' -delete

Backup and Restore MySQL Database Using mysqldump

mysqldump is an effective tool to backup MySQL database. It creates a *.sql file with DROP table, CREATE table and INSERT into sql-statements of the source database. To restore the database, execute the *.sql file on destination database. For MyISAM, use mysqlhotcopy method that we explained earlier, as it is faster for MyISAM tables.

Read the rest of this entry »

Disabling email service for a domain in Plesk

I´ve just figured out that there is (or .. may be …) a problem with mailing, if the webserver (Ubuntu / Plesk) is a different one than the mailserver. The mails are simply not sent, because foreign mx assigns are not accepted. The trick is to disable E-Mail services for a specific domain:

  • Correct the DNS entry for MX records in the DNS manager
    Go to websites & Domain –>> DNS
    Modify the MX record with the ip of your (external) mailserver.
    (don´t know if this step is really necessary when disabling the services in the next step).
  • SSH login to the server and disabled the mail service associated with that domain.
    /usr/local/psa/bin/domain -u domain.tld -mail_service false 

That’s it

Plesk clear qmail queue

I will describe today how you can clear the queue for qmail, for a server that is running Plesk.

Read the rest of this entry »