remove path bin

This commit is contained in:
shoopea 2021-11-04 21:15:45 +08:00
parent f17039d370
commit 95d4fce73d
2 changed files with 6 additions and 6 deletions

10
app.go
View File

@ -463,7 +463,7 @@ func (a AppConfig) TakeSnapshot(schedule string) error {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.TakeSnapshot : %s : taking snapshot on %s for %s", a.Name, k, v) log.Printf("AppConfig.TakeSnapshot : %s : taking snapshot on %s for %s", a.Name, k, v)
} }
err := cfg.Box[k].ssh.exec("/usr/sbin/zfsnap snapshot -p " + schedule + "- -a " + cfg.Zfsnap[schedule] + v) err := cfg.Box[k].ssh.exec("zfsnap snapshot -p " + schedule + "- -a " + cfg.Zfsnap[schedule] + v)
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.TakeSnapshot : %s : Error executing zfsnap on %s", a.Name, k) log.Printf("AppConfig.TakeSnapshot : %s : Error executing zfsnap on %s", a.Name, k)
@ -527,7 +527,7 @@ func (a AppConfig) SendSnapshots() error {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Initializing snapshot on %s from %s", a.Name, dest.Box(), string(sFirstSnapshot)) log.Printf("AppConfig.SendSnapshots : %s : Initializing snapshot on %s from %s", a.Name, dest.Box(), string(sFirstSnapshot))
} }
err = cfg.Box[dest.Box()].ssh.exec("/usr/bin/ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " /sbin/zfs send " + string(sFirstSnapshot) + " | /sbin/zfs recv -F " + dest.Path() + "/" + src.Box() + "/" + src.Path()) err = cfg.Box[dest.Box()].ssh.exec("ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " zfs send " + string(sFirstSnapshot) + " | zfs recv -F " + dest.Path() + "/" + src.Box() + "/" + src.Path())
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Initializing snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sFirstSnapshot), err) log.Printf("AppConfig.SendSnapshots : %s : Initializing snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sFirstSnapshot), err)
@ -542,7 +542,7 @@ func (a AppConfig) SendSnapshots() error {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Sending incrementally %s to %s", a.Name, string(sNextSnapshot), dest.Box()) log.Printf("AppConfig.SendSnapshots : %s : Sending incrementally %s to %s", a.Name, string(sNextSnapshot), dest.Box())
} }
err = cfg.Box[dest.Box()].ssh.exec("/usr/bin/ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " /sbin/zfs send -I " + string(sCurrSnapshot) + " " + string(sNextSnapshot) + " | /sbin/zfs recv " + dest.Path() + "/" + src.Box() + "/" + src.Path()) err = cfg.Box[dest.Box()].ssh.exec("ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " zfs send -I " + string(sCurrSnapshot) + " " + string(sNextSnapshot) + " | zfs recv " + dest.Path() + "/" + src.Box() + "/" + src.Path())
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Sending snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sNextSnapshot), err) log.Printf("AppConfig.SendSnapshots : %s : Sending snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sNextSnapshot), err)
@ -566,7 +566,7 @@ func (a AppConfig) SendSnapshots() error {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Sending incrementally %s to %s", a.Name, string(sNextSnapshot), dest.Box()) log.Printf("AppConfig.SendSnapshots : %s : Sending incrementally %s to %s", a.Name, string(sNextSnapshot), dest.Box())
} }
err = cfg.Box[dest.Box()].ssh.exec("/usr/bin/ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " /sbin/zfs send -I " + string(sCurrSnapshot) + " " + string(sNextSnapshot) + " | /sbin/zfs recv " + dest.Path() + "/" + src.Box() + "/" + src.Path()) err = cfg.Box[dest.Box()].ssh.exec("ssh " + cfg.Box[src.Box()].User + "@" + src.Box() + " zfs send -I " + string(sCurrSnapshot) + " " + string(sNextSnapshot) + " | zfs recv " + dest.Path() + "/" + src.Box() + "/" + src.Path())
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.SendSnapshots : %s : Sending snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sNextSnapshot), err) log.Printf("AppConfig.SendSnapshots : %s : Sending snapshot on %s from %s failed (%s)", a.Name, dest.Box(), string(sNextSnapshot), err)
@ -598,7 +598,7 @@ func (a AppConfig) CleanupSnapshot() error {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.CleanupSnapshot : %s : cleaning snapshots on %s for%s", a.Name, k, v) log.Printf("AppConfig.CleanupSnapshot : %s : cleaning snapshots on %s for%s", a.Name, k, v)
} }
err := cfg.Box[k].ssh.exec("/usr/sbin/zfsnap destroy -p hourly- -p daily- -p weekly- -p monthly- -p yearly-" + v) err := cfg.Box[k].ssh.exec("zfsnap destroy -p hourly- -p daily- -p weekly- -p monthly- -p yearly-" + v)
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("AppConfig.CleanupSnapshot : %s : Error executing zfsnap on %s", a.Name, k) log.Printf("AppConfig.CleanupSnapshot : %s : Error executing zfsnap on %s", a.Name, k)

View File

@ -114,7 +114,7 @@ func (c *Config) Load() error {
var b bytes.Buffer var b bytes.Buffer
session.Stdout = &b session.Stdout = &b
err = session.Run("TZ=\"" + cfg.Timezone + "\" /usr/sbin/zfsnap --version") err = session.Run("TZ=\"" + cfg.Timezone + "\" zfsnap --version")
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
log.Printf("Config.Load : client.NewSession(%s) : %s", k, err) log.Printf("Config.Load : client.NewSession(%s) : %s", k, err)