Noticed that FAQ/Common Errors section of README.md said that mycroft.… (#221)

* Noticed that FAQ/Common Errors section of README.md said that mycroft.sh would start the cli, so I added it.

* changed three to four for FAQ since four processes are listed.

* added --quiet option to start.sh cli to prevent echo when using the cli

* per @the7erm sugestion: changed the log flush to 1 second for screen.

* modified mycroft.sh to support starting in three modes:
- service, skills, voice, cli --quiet
- service skills, voice
- service skills, cli

* Added changes to quick start to reflect changes to mycroft.sh
pull/228/head
Jason Hines 2016-06-23 13:13:45 -04:00 committed by Ethan Ward
parent f28c75c639
commit 27b73844d4
6 changed files with 75 additions and 34 deletions

View File

@ -75,9 +75,11 @@ Mycroft configuration consists of 3 possible config files.
When the configuration loader starts, it looks in those locations in that order, and loads ALL configuration. Keys that exist in multiple config files will be overridden by the last file to contain that config value. This results in a minimal amount of config being written for a specific device/user, without modifying the distribution files.
# Running Mycroft Quick Start
To start the essential tasks run `./mycroft.sh start`. Which will start the service, skills and voice in a detched screen and log the output of the screens to the their respective log files (e.g. ./log/mycroft-service.log).
To start the essential tasks run `./mycroft.sh start`. Which will start the service, skills, voice and cli (using --quiet mode) in a detched screen and log the output of the screens to the their respective log files (e.g. ./log/mycroft-service.log).
Optionally you can run `./mycroft.sh start -v` Which will start the service, skills and voice. Or `./mycroft.sh start -c` Which will start the service, skills and cli.
To stop Mycroft run `./mycroft.sh stop`. This will quit all of the detached screens.
To restart Mycroft run './mycroft.sh restart`.
Quick screen tips
- run `screen -list` to see all running screens
@ -120,4 +122,4 @@ source ~/.virtualenvs/mycroft/bin/activate
#### When running mycroft, I get the error `mycroft.messagebus.client.ws - ERROR - Exception("Uncaught 'error' event.",)`
This means that you are not running the `./start.sh service` process. In order to fully run Mycroft, you must run `./start.sh service`, `./start.sh skills`, and `./start.sh voice`/`./start.sh cli` all at the same time. This can be done using different terminal windows, or by using the included `./mycroft.sh start`, which runs all three process using `screen`.
This means that you are not running the `./start.sh service` process. In order to fully run Mycroft, you must run `./start.sh service`, `./start.sh skills`, and `./start.sh voice`/`./start.sh cli` all at the same time. This can be done using different terminal windows, or by using the included `./mycroft.sh start`, which runs all four process using `screen`.

4
mycroft-cli.screen Normal file
View File

@ -0,0 +1,4 @@
deflog on
logfile logs/mycroft-cli.log
logfile flush 1

View File

@ -1,2 +1,3 @@
deflog on
logfile logs/mycroft-service.log
logfile flush 1

View File

@ -1,2 +1,4 @@
deflog on
logfile logs/mycroft-skills.log
logfile flush 1

View File

@ -1,2 +1,4 @@
deflog on
logfile logs/mycroft-voice.log
logfile flush 1

View File

@ -12,9 +12,11 @@ function usage {
echo
echo "Quickly start, stop or restart Mycroft's esential services in detached screens"
echo
echo "usage: $0 [-h] (start|stop|restart)"
echo "usage: $0 [-h] (start [-v|-c]|stop|restart)"
echo " -h this help message"
echo " start starts mycroft-service, mycroft-skills and mycroft-voice"
echo " start starts mycroft-service, mycroft-skills, mycroft-voice and mycroft-cli in quiet mode"
echo " start -v starts mycroft-service, mycroft-skills and mycroft-voice"
echo " start -c starts mycroft-service, mycroft-skills and mycroft-cli"
echo " stop stops mycroft-service, mycroft-skills and mycroft-voice"
echo " restart restarts mycroft-service, mycroft-skills and mycroft-voice"
echo
@ -26,13 +28,11 @@ function usage {
echo
}
function verify-start() {
# check if screen for service was started
if screen -list | grep -q "$1";
mkdir -p $DIR/logs
function verify-start {
if ! screen -list | grep -q "$1";
then
:
else
# else echo tail logs/mycroft-service.log
echo "$1 failed to start. The log is below:"
echo
tail $DIR/logs/$1.log
@ -40,23 +40,40 @@ function verify-start() {
fi
}
function start-mycroft {
mkdir -p $DIR/logs
screen -mdS mycroft-service -c $DIR/mycroft-service.screen $DIR/start.sh service
screen -mdS mycroft-$1$2 -c $DIR/mycroft-$1.screen $DIR/start.sh $1 $2
sleep 1
verify-start mycroft-service
screen -mdS mycroft-skills -c $DIR/mycroft-skills.screen $DIR/start.sh skills
sleep 1
verify-start mycroft-skills
screen -mdS mycroft-voice -c $DIR/mycroft-voice.screen $DIR/start.sh voice
sleep 1
verify-start mycroft-voice
verify-start mycroft-$1$2
echo "Mycroft $1$2 started"
}
function stop-mycroft {
screen -XS mycroft-service quit
screen -XS mycroft-skills quit
screen -XS mycroft-voice quit
if screen -list | grep -q "$1";
then
screen -XS mycroft-$1 quit
echo "Mycroft $1 stopped"
fi
}
function restart-mycroft {
if screen -list | grep -q "quiet";
then
$0 stop
sleep 1
$0 start
elif screen -list | grep -q "cli" && ! screen -list | grep -q "quiet";
then
$0 stop
sleep 1
$0 start -c
elif screen -list | grep -q "voice" && ! screen -list | grep -q "quiet";
then
$0 stop
sleep 1
$0 start -v
else
echo "An error occurred"
fi
}
set -e
@ -65,22 +82,35 @@ if [[ -z "$1" || "$1" == "-h" ]]
then
usage
exit 1
elif [ "$1" == "start" ]
elif [[ "$1" == "start" && -z "$2" ]]
then
start-mycroft
echo "Mycroft Started"
start-mycroft service
start-mycroft skills
start-mycroft voice
start-mycroft cli --quiet
exit 0
elif [ "$1" == "stop" ]
elif [[ "$1" == "start" && "$2" == "-v" ]]
then
stop-mycroft
echo "Mycroft Stopped"
start-mycroft service
start-mycroft skills
start-mycroft voice
exit 0
elif [ "$1" == "restart" ]
elif [[ "$1" == "start" && "$2" == "-c" ]]
then
stop-mycroft
echo "Stopping Mycroft"
start-mycroft
echo "Mycroft restarted"
start-mycroft service
start-mycroft skills
start-mycroft cli
exit 0
elif [[ "$1" == "stop" && -z "$2" ]]
then
stop-mycroft service
stop-mycroft skills
stop-mycroft voice
stop-mycroft cli
exit 0
elif [[ "$1" == "restart" && -z "$2" ]]
then
restart-mycroft
exit 0
else
usage