Skip to content

Commit

Permalink
Fix for missing crontab in arch
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrendek committed Sep 30, 2023
1 parent 6a62b5d commit 2062e26
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sysward-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,18 @@ func (a *Agent) Run() {

func (a *Agent) InstallCron() {
if !fileReader.FileExists("/etc/crontab") {
out, err := runner.Run("apt-get", "install", "cron", "-y")
logging.LogMsg("+ installing cron package: " + string(out))
if err != nil {
logging.LogMsg("Error installing cron: " + err.Error())
if a.linux == "debian" {
out, err := runner.Run("apt-get", "install", "cron", "-y")
logging.LogMsg("+ installing cron package: " + string(out))
if err != nil {
logging.LogMsg("Error installing cron: " + err.Error())
}
} else if a.linux == "arch" {
out, err := runner.Run("pacman", "-S", "cron", "--noconfirm")
logging.LogMsg("+ installing cron package: " + string(out))
if err != nil {
logging.LogMsg("Error installing cron: " + err.Error())
}
}
}
cronString := "*/5 * * * * root cd /opt/sysward/bin && ./sysward >> /dev/null\n"
Expand Down

0 comments on commit 2062e26

Please sign in to comment.