Skip to content

Commit

Permalink
Fix: incorrect name in notifications, different reboot logic
Browse files Browse the repository at this point in the history
  • Loading branch information
danesparza committed Sep 13, 2017
1 parent 25df766 commit 430e865
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions network/wifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ func UpdateWifiCredentials(ssid, password string) error {

// RebootMachine calls sync and reboots the machine
func RebootMachine() {
log.Println("[INFO] Rebooting...")
go func() {
log.Println("[INFO] Rebooting...")
}()

// Wait before exiting, in order to give our parent enough time to finish
countdownBeforeExit := time.NewTimer(time.Second * 3)
<-countdownBeforeExit.C
time.Sleep(3 * time.Second)

log.Println("[WARN] Not running on Linux/ARM, so not rebooting")
}
9 changes: 5 additions & 4 deletions network/wifi_linux_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ func UpdateWifiCredentials(ssid, password string) error {

// RebootMachine calls sync and reboots the machine
func RebootMachine() {
log.Println("[INFO] Rebooting...")
syscall.Sync()
go func() {
log.Println("[INFO] Rebooting...")
syscall.Sync()
}()

// Wait before exiting, in order to give our parent enough time to finish
countdownBeforeExit := time.NewTimer(time.Second * 3)
<-countdownBeforeExit.C
time.Sleep(3 * time.Second)

syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
}
2 changes: 1 addition & 1 deletion sensordata/collect_linux_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func sendPushoverNotification(c data.ConfigDB, runningTime int) error {
// Create a new client and push a message
pushClient := pushover.New(pushAPIkey.Value)
recipient := pushover.NewRecipient(pushTo.Value)
message := pushover.NewMessage(fmt.Sprintf("%v has finished running. It ran for about %v minutes", applianceName, runningTime))
message := pushover.NewMessage(fmt.Sprintf("%s has finished running. It ran for about %v minutes", applianceName.Value, runningTime))
message.Sound = "bike"
_, err := pushClient.SendMessage(message, recipient)
if err != nil {
Expand Down

0 comments on commit 430e865

Please sign in to comment.