Archive of

A quick way to run a database update periodically by crontab

  1. put a .my.cnf file into your home directory, for example
$ cat ~/.my.cnf 
[client]
user=yourDbUserName
password=yourDbPassword
host=yourDbHost
  1. write a bash script to update the database
#!/bin/bash

set -ex

variable=`TZ="Africa/Abidjan" date '+%Y-%m-%d %H:%M:%S'`
sql="Your SQL statement with ${variable}"

logDir=/data/Logs/`date '+%Y'`/`date '+%m'`
mkdir -p "${logDir}"
echo "${sql}" >> "${logDir}/`date '+%d'`.sql"
mysql -v -v -e "${sql}" >> "${logDir}/`date '+%d'`.result.txt"
  1. put a line by run crontab -e

the end.

vue-cli-service Modes vs Environment Variables

严格来说,二者是两个维度,并没有必然的固定的映射关系。只是通常情况下,约定俗成的:

--mode test <=> NODE_ENV=test
--mode development <=> NODE_ENV=development
--mode production <=>  NODE_ENV=production
--mode staging <=> NODE_ENV=staging

那怎么知道手头的项目是否符合这个约定俗成呢?通常来说,你可以看一下项目根目录下的 .env 系列文件,一般情况下,NODE_ENV 变量会定义在那里。