FIXME: Update Last_started

This commit is contained in:
yo 2022-11-20 20:19:37 +01:00
parent 89db166040
commit 54fd1f8064

View File

@ -4,6 +4,7 @@ import (
"os" "os"
"fmt" "fmt"
"net" "net"
"time"
"errors" "errors"
"regexp" "regexp"
"reflect" "reflect"
@ -945,7 +946,7 @@ func setupVnetInterfaceJailSide(jail *Jail, hsepair string) error {
// Get bridge MTU // Get bridge MTU
mtu, err := gJailHost.GetBridgeMTU(bridge) mtu, err := gJailHost.GetBridgeMTU(bridge)
if err != nil { if err != nil {
return fmt.Errorf("Error getting bridge mtu: %v\n", err) return fmt.Errorf("Error getting bridge %s mtu: %v\n", bridge, err)
} }
cmd = fmt.Sprintf("/usr/sbin/jexec %d ifconfig %s mtu %d", jail.JID, jsepair, mtu) cmd = fmt.Sprintf("/usr/sbin/jexec %d ifconfig %s mtu %d", jail.JID, jsepair, mtu)
@ -1309,7 +1310,7 @@ func StartJail(args []string) {
} }
// Synchronize jail config to disk // Synchronize jail config to disk
WriteConfigToDisk(false) WriteConfigToDisk(cj.Name, false, false)
start_cmd := fmt.Sprintf("/usr/sbin/jail -f /var/run/jail.%s.conf -c", cj.InternalName) start_cmd := fmt.Sprintf("/usr/sbin/jail -f /var/run/jail.%s.conf -c", cj.InternalName)
@ -1455,6 +1456,11 @@ func StartJail(args []string) {
// TODO: Handle dhcp // TODO: Handle dhcp
// TODO: Apply rctl // TODO: Apply rctl
// Update last_started
dt := time.Now()
curDate := fmt.Sprintf("%s", dt.Format("2006-01-02 15:04:05"))
fmt.Sprintf(cj.Config.Last_started, curDate)
WriteConfigToDisk(cj.Name, false, true)
/* /*