Skip to content

Commit

Permalink
set max-mount-count to 1 for fsck, use flock for vpn related scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyc committed Nov 7, 2018
1 parent c4865f4 commit 356fffa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/prep/03_setup_fsck_schedule.sh
@@ -1,6 +1,6 @@
#!/bin/bash

MOUNT_COUNT=20
MOUNT_COUNT=1
INTERVAL=4w

for device in `ls -1 /dev/mmcblk0p*`; do
Expand Down
9 changes: 6 additions & 3 deletions vpn/VpnManager.js
Expand Up @@ -86,7 +86,8 @@ module.exports = class {
if (err == null) {
// !! Pay attention to the parameter "-E" which is used to preserve the
// enviornment variables when running sudo commands
let install2_cmd = util.format("cd %s/vpn; sudo -E ./install2.sh %s", fHome, instance);
const installLockFile = "/dev/shm/vpn_install2_lock_file";
let install2_cmd = util.format("cd %s/vpn; flock -n %s -c 'sudo -E ./install2.sh %s'; sync", fHome, installLockFile, instance);
log.info("VPNManager:INSTALL:cmd", install2_cmd);
this.install2 = require('child_process').exec(install2_cmd, (err, out, code) => {
if (err) {
Expand Down Expand Up @@ -133,8 +134,10 @@ module.exports = class {
if (mydns == null) {
mydns = "8.8.8.8"; // use google DNS as default
}
const cmd = util.format("cd %s/vpn; sudo -E ./confgen.sh %s %s %s %s %s",
fHome, this.instanceName, sysManager.myIp(), mydns, this.serverNetwork, this.localPort);
const confGenLockFile = "/dev/shm/vpn_confgen_lock_file";
const cmd = util.format("cd %s/vpn; flock -n %s -c 'sudo -E ./confgen.sh %s %s %s %s %s'; sync",
fHome, confGenLockFile, this.instanceName, sysManager.myIp(), mydns, this.serverNetwork, this.localPort);
log.info("VPNManager:CONFIGURE:cmd", cmd);
require('child_process').exec(cmd, (err, out, code) => {
if (err) {
log.error("VPNManager:CONFIGURE:Error", "Unable to generate server config for " + this.instanceName, err);
Expand Down

0 comments on commit 356fffa

Please sign in to comment.