forked from circleci/circleci-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jctl
executable file
·49 lines (42 loc) · 1 KB
/
jctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
function rebuild {
vagrant ssh -c "pkill -f jekyll"
# Below helps with a VirtualBox bug (https://www.virtualbox.org/ticket/9069)
vagrant ssh -c "sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'"
start
}
function restart {
stop
start
}
function start {
if ! vagrant status | grep -q "running"; then
vagrant up
fi
# Building and serving is done separate to provide more feedback. nohup blocks errors.
echo "Building with jekyll..."
vagrant ssh -c "jekyll build --incremental -s /vagrant/jekyll -d /vagrant/jekyll/_site"
echo "Site built, now starting the server in the background..."
vagrant ssh -c "nohup jekyll serve --skip-initial-build -s /vagrant/jekyll -d /vagrant/jekyll/_site --host 0.0.0.0 --detach"
echo "Site should now be available in your browser at http://localhost:4040/docs/"
}
function stop {
vagrant halt
}
case $1 in
"start")
start
;;
"rebuild")
rebuild
;;
"restart")
restart
;;
"stop")
stop
;;
*)
echo "That is not a valid subcommand."
;;
esac