Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Install = &cobra.Command{ Use: "install", Short: "Install", Run: func(c *cobra.Command, args []string) { name := cmd.Use err := os.WriteFile(fmt.Sprintf("/etc/systemd/system/%s.service", name), []byte(fmt.Sprintf(` [Unit] Description=%s After=network.target [Service] Type=simple WorkingDirectory=%s ExecStart=%s run Restart=always RestartSec=30s [Install] WantedBy=multi-user.target `, strings.ToUpper(name), app.Dir, filepath.Join(app.Dir, name))), os.ModePerm) if err != nil { fmt.Print(err) return } _, err = utl.Command(fmt.Sprintf("systemctl enable %s", name), "systemctl daemon-reload", fmt.Sprintf("systemctl restart %s", name)) if err != nil { fmt.Print(err) } }, } )
View Source
var ( Start = &cobra.Command{ Use: "start", Short: "Start", Run: func(c *cobra.Command, args []string) { name := cmd.Use _, err := utl.Command(fmt.Sprintf("systemctl restart %s", name)) if err != nil { fmt.Print(err) } }, } )
View Source
var ( Status = &cobra.Command{ Use: "status", Short: "Status", Run: func(c *cobra.Command, args []string) { name := cmd.Use _, err := utl.Command(fmt.Sprintf("systemctl status %s", name)) if err != nil { fmt.Print(err) } }, } )
View Source
var ( Stop = &cobra.Command{ Use: "stop", Short: "Stop", Run: func(c *cobra.Command, args []string) { name := cmd.Use _, err := utl.Command(fmt.Sprintf("systemctl stop %s", name)) if err != nil { fmt.Print(err) } }, } )
View Source
var ( Uninstall = &cobra.Command{ Use: "uninstall", Short: "Uninstall", Run: func(c *cobra.Command, args []string) { name := cmd.Use _, err := utl.Command(fmt.Sprintf("systemctl stop %s", name), fmt.Sprintf("systemctl disable %s", name)) if err != nil { fmt.Print(err) return } err = utl.Remove(fmt.Sprintf("/etc/systemd/system/%s.service", name)) if err != nil { fmt.Print(err) } }, } )
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.