Skip to content

Commit

Permalink
fixed startup
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Feb 2, 2014
1 parent ed911d4 commit ad12003
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Expand Up @@ -31,7 +31,4 @@ RUN sed -i s/mxs/$USERNAME/ ./all.bash && \
EXPOSE 3112

# here we go
CMD touch ./root/gorobot.log && \
chown -R $USERNAME . && \
./all.bash start && \
tail -F ./root/gorobot.log
CMD ./start.sh
3 changes: 2 additions & 1 deletion all.bash
Expand Up @@ -137,7 +137,8 @@ case $1 in

# build the website
ok "building $PROJECT..."
go build -o $CHDIR/$PROJECT
go build -o $PROJECT
cp $PROJECT $CHDIR/$PROJECT
warn-upon-failure $? "unable to build $PROJECT"
ok "$PROJECT built (or not)..."
exit 0
Expand Down
7 changes: 4 additions & 3 deletions m1ch3l.go
Expand Up @@ -68,7 +68,7 @@ type Action struct {
Raw string // If Type = RAW, send this directly over the server
}

// Main config of m1ch3l
// Main config of gorobot
type Config struct {
AutoRejoinOnKick bool // Rejoin channel when kicked
Logs ConfigLogs // Log config
Expand Down Expand Up @@ -104,7 +104,7 @@ type ConfigChannel struct {

// Flag settings
var (
configPath = flag.String("c", "m1ch3l.json", "path to the configuration file (e.g, m1ch3l.json)")
configPath = flag.String("c", "gorobot.json", "path to the configuration file (e.g, gorobot.json)")
)

// Creates a new Config from a config file
Expand All @@ -120,14 +120,15 @@ func newConfig(path string) *Config {
}

// redirect logging to a file
writer, err := os.OpenFile("m1ch3l.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
writer, err := os.OpenFile("gorobot.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
log.Fatalf("Unable to open file log: %v", err)
}
log.SetOutput(writer)
return &cfg
}


func main() {
flag.Parse()
cfg := newConfig(*configPath)
Expand Down
7 changes: 7 additions & 0 deletions start.sh
@@ -0,0 +1,7 @@
#!/bin/bash

cp gorobot root/gorobot && \
touch ./root/gorobot.log && \
chown -R $USERNAME . && \
./all.bash start && \
tail -F ./root/gorobot.log

0 comments on commit ad12003

Please sign in to comment.