Skip to content
This repository was archived by the owner on Dec 9, 2019. It is now read-only.

Commit 5d1e70b

Browse files
committed
[skip ci] SysVInit changes for ubuntu 14.04
1 parent d5251d5 commit 5d1e70b

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

cli/Valet/DnsMasq.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ private function _mergeDns()
8686
$this->files->backup($this->resolvconf);
8787
$this->files->unlink($this->resolvconf);
8888
$this->files->symlink($script, $this->resolvconf);
89-
$this->sm->start('valet-dns');
9089

9190
return true;
9291
}
@@ -105,6 +104,7 @@ public function install($domain = 'test')
105104
$this->createCustomConfigFile($domain);
106105
$this->pm->nmRestart($this->sm);
107106
$this->sm->restart('dnsmasq');
107+
$this->sm->start('valet-dns');
108108
}
109109

110110
/**

cli/stubs/init/sysvinit

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
1616
PIDFILE=/opt/valet-linux/watch.pid
17+
LOGFILE=/opt/valet-linux/watch.log
1718
DAEMON=/opt/valet-linux/valet-dns
1819
NAME=valet-dns
1920
DESC="Valet DNS Resolution"
@@ -26,13 +27,16 @@ test -x $DAEMON || exit 0
2627
. /lib/lsb/init-functions
2728

2829
start() {
29-
test -f $PIDFILE && rm $PIDFILE
30+
test -f "$PIDFILE" && rm "$PIDFILE"
3031
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON start || return 2
3132
}
3233

3334
stop() {
34-
start-stop-daemon --stop --retry=$STOP_SCHEDULE --pidfile $PIDFILE || return 1
35-
test -f $PIDFILE && rm $PIDFILE
35+
if [ -f "$PIDFILE" ]; then
36+
start-stop-daemon --stop --retry=$STOP_SCHEDULE --pidfile $PIDFILE && rm "$PIDFILE" || return 1
37+
fi
38+
39+
test -f "$LOGFILE" && rm "$LOGFILE"
3640
}
3741

3842
case "$1" in

cli/stubs/valet-dns

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function watchDirs() {
9292
local WATCHERS=(${DIRS[@]} "$DNSHEAD")
9393

9494
# Log which directories are being watched
95-
echo "Watching the following directories:" >> "$LOGFILE"
95+
echo "Watching the following directories for changes:" >> "$LOGFILE"
9696

9797
for DIR in "${DIRS[@]}"; do
9898
echo " - $DIR" >> "$LOGFILE"
@@ -163,7 +163,12 @@ function restart {
163163
}
164164

165165
function status {
166-
cat '/opt/valet-linux/watch.log'
166+
if [[ -f "$LOGFILE" ]]; then
167+
echo -e "Valet DNS service is running correctly.\n"
168+
cat '/opt/valet-linux/watch.log'
169+
else
170+
echo "Valet DNS service is not running."
171+
fi
167172
}
168173

169174
case "$1" in

0 commit comments

Comments
 (0)