|
@ -1,11 +1,13 @@ |
|
|
'use strict'; |
|
|
'use strict'; |
|
|
|
|
|
|
|
|
const shell = require('shelljs'); |
|
|
const shell = require('shelljs'); |
|
|
|
|
|
const path = require('path'); |
|
|
|
|
|
|
|
|
const { EOL } = require('os'); |
|
|
const { EOL } = require('os'); |
|
|
|
|
|
|
|
|
const npath = require('../utils/nginxPath'); |
|
|
const npath = require('../utils/nginxPath'); |
|
|
const conf = require('../utils/nginxConf'); |
|
|
const conf = require('../utils/nginxConf'); |
|
|
|
|
|
const nginxReload = require('../utils/nginxReload'); |
|
|
|
|
|
|
|
|
function killALL () { |
|
|
function killALL () { |
|
|
shell.rm('-Rf', npath.serversBakUp); |
|
|
shell.rm('-Rf', npath.serversBakUp); |
|
@ -17,21 +19,20 @@ function killALL () { |
|
|
shell.mkdir('-p', npath.confD()); |
|
|
shell.mkdir('-p', npath.confD()); |
|
|
shell.mkdir('-p', npath.enabledSites()); |
|
|
shell.mkdir('-p', npath.enabledSites()); |
|
|
shell.mkdir('-p', npath.webRoot()); |
|
|
shell.mkdir('-p', npath.webRoot()); |
|
|
shell.cp('./build/defaultNginx.conf', conf(npath.confD())); |
|
|
shell.cp((path.join(__dirname, '/../build/defaultNginx.conf')), |
|
|
|
|
|
conf(npath.enabledSites())); |
|
|
// Create the default.conf file
|
|
|
// Create the default.conf file
|
|
|
shell.ln('-sf', npath.confD() + "default.conf", |
|
|
|
|
|
npath.enabledSites() + "default.conf"); |
|
|
|
|
|
// Symlink the default.conf file from confD to sites-enabled
|
|
|
|
|
|
console.log("All servers were killed and reverted to default."); |
|
|
console.log("All servers were killed and reverted to default."); |
|
|
console.log(EOL + [ |
|
|
console.log(EOL + [ |
|
|
"A backup of your old servers.up is " + |
|
|
"A backup of your old servers.up is " + |
|
|
"saved in /etc/up-serve/servers.bak.up.", |
|
|
"saved in /etc/up-serve/servers.bak.up.", |
|
|
"Check this if you need to." |
|
|
"Check this if you need to." |
|
|
].join(EOL) + EOL); |
|
|
].join(EOL) + EOL); |
|
|
|
|
|
nginxReload(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function noKill () { |
|
|
function noKill () { |
|
|
console.log("\nkill-all was interrupted by user."); |
|
|
console.log(EOL + "kill-all was interrupted by user."); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
module.exports.kill = killALL; |
|
|
module.exports.kill = killALL; |
|
|