demosite

  • joomla_cms

    The demo site demo.waltercedric.com is automatically deleted (database and file system) and restored every 60 minutes to wipe the system clean for other new users.

    login to Administrator panel is

    login admin
    password admin

    How I've done it...
     green value have to been replace

    1. Create all needed directories
    Ex for plesk
    # mkdir /var/www/vhosts/waltercedric.com/private/db-demo-initial
    # mkdir /var/www/vhosts/waltercedric.com/private/file-demo-initial

    2. First make a INITIAL backup from the database
    In the state you want it to be for your demosite with mysqldump:
    # mysqldump -u [DatabaseUsername] -p [DatabasePassword] [DatabaseName] > /path/to/filename

    Ex for plesk
    Files are store in private directory so only me can access them.
    # mysqldump -uDatabaseUser -pDatabasePassword DatabaseName > /var/www/vhosts/waltercedric.com/private/db-demo-initial/DatabaseName.sql

    3. Then make an INITIAL backup of the file structure
    #  cp -pir srcDirectoy destinationDirectory

    Ex for plesk
    # cp -prf /var/www/vhosts/waltercedric.com/subdomains/demo/httpdocs/* /var/www/vhosts/waltercedric.com/private/file-demo-initial

    4. Then put everything in a CRONTAB

    The purpose of this task is to restore file periodically, You can use mysqqlimport (but it didnt worked for Me), so I use the mysql command line
    If you want lets say: restore database every 1 hours, ten past the hour, your crontab entry would look like this:

    10 */1 * * * mysql -u[username] -p[password] [databasename] < [/path/to/filename]

    If you want lets say: restore file every 1 hours, twenty past the hour, your crontab entry would look like this:
    20 */1 * * *  cp -pir srcDirectoy destinationDirectory

    Ex
    5 */1 * * * cp -prf /var/www/vhosts/waltercedric.com/private/file-demo-initial/*  /var/www/vhosts/waltercedric.com/subdomains/demo/httpdocs
    6 */1 * * * mysql -uXXXX -pYYYYY demo < /var/www/vhosts/waltercedric.com/private/db-demo-initial/demo.sql