npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mysql-wordpress-dump

v1.0.8

Published

Ideal for backing the database information and wp-content of your wordpress.

Downloads

33

Readme

Installation

Using npm:

$ npm i --save mysql-wordpress-dump

Use in Node.js

Config File

'use strict'

const StorageClass = require('mysql-wordpress-dump').storage

module.exports = {
  mysql: {
    production: {
      storageOne: new StorageClass('host', 'user', 'password', 'port', 'database')
    },
    develop: {
      storageDevOne: new StorageClass('host', 'user', 'password', 'port', 'database')
    }
  },
  wordpress: {
    production: {
      locationOne: '/var/www/html/site/wp-content'
    },
    develop: {
      locationDevOne: '/var/www/html/site/wp-content'
    }
  },
  backups: {
    MAX_FILES: 10,
    TYPE: 'save',
    SRC: {
      production: '/home/temp',
      develop: '/home/dev/temp'
    }
  },
  log: {
    messages: {
      'exit': 'message',
      'wordpress-start': 'message',
      'mysql-start': 'message'
    }
  }
}

Index application

const config = require('./config')
const DumpClass = require('mysql-wordpress-dump').dump
const dump = new DumpClass(config)

dump.startDump()

process.on('exit', () => {
  console.log(config['log']['messages']['exit'])
})

How do I install, create or edit my own cron job?

To edit or create your own crontab file, type the following command at the UNIX / Linux shell prompt:

$ export EDITOR=nano (optional)
$ crontab -e

Do I have to restart cron after changing the crontable file?

No. Cron will examine the modification time on all crontabs and reload those which have changed. Cron does not need to be restarted whenever a crontab file is modified.

Syntax of crontab (field description)

The syntax is:

1 2 3 4 5 /path/to/command arg1 arg2

Where,

  • 1: Minute (0-59)
  • 2: Hours (0-23)
  • 3: Day (0-31)
  • 4: Month (0-12 [12 == December])
  • 5: Day of the week(0-7 [7 or 0 == sunday])
  • /path/to/command – Script or command name to schedule

Easy to remember format:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

Create CronTab Script

Set the task execution time

Go to Crontab Guru.

Get Node install localtion

Write the following command in the terminal:

$ which node

Get application location in the system

Enter the following command in the application folder:

$ pwd

Add Backup Type (MySQL Or Wordpress)

If you work with environment variables, you should only set the value BACKUP_ENV to mysql OR wordpress.

This value is required in the command line if you are not working with environment variables. Add mysql OR wordpress after the app location.

For Example:

1 2 3 4 5 /path/to/node /path/to/app/file.js mysql

Add Execution environment

If you work with environment variables, you should only set the value NODE_ENV to develop OR production.

By default the value is production, so you can skip entering this value if you work from a production server.

IMPORTANT: If you work from a development server and you are not working with environment variables, this value is necessary in the command line, otherwise you will be working with the production values. Add develop after the backup type.

Develop Example (Without NODE_ENV):

1 2 3 4 5 /path/to/node /path/to/app/file.js mysql develop

Develop Example (With NODE_ENV = develop):

1 2 3 4 5 /path/to/node /path/to/app/file.js mysql

Production Example (With or without NODE_ENV = production):

1 2 3 4 5 /path/to/node /path/to/app/file.js mysql

Add output file for application logs (Optional)

If you want to keep a file for the executions of the application you must add the following to the end of crontab script

1 2 3 4 5 /path/to/node /path/to/app/filefile.js mysql develop >> /path/to/logs/log-file.log 2>&1

Full Example

* * * * * ${which node} ${pwd-application}/${filename}.js ${backup-type} ${env} >> ${pwd-logs-location}/${log-filename}.log 2>&1

Full Example Without Crontab

node ${filename}.js ${backup-type} ${env}

More info