create_service

package
v0.82.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "create-service",
	Short:   "Create systemd service file",
	Aliases: []string{"cs"},
	Args:    cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		out, err := systemd_utils.CreateSystemdServiceString(
			FlagName,
			FlagDescription,
			FlagUser,
			FlagGroup,
			FlagWorkingDirectory,
			FlagExecStart,
		)
		if err != nil {
			log.Fatalln(err)
		}
		if FlagCreateFile {
			err := os.WriteFile(
				"/etc/systemd/system/"+FlagName+".service", []byte(out), 0644)
			if err != nil {
				log.Fatalln(err)
			}
		} else {
			fmt.Println(out)
		}
	},
}
View Source
var FlagCreateFile bool
View Source
var FlagDescription string
View Source
var FlagExecStart string
View Source
var FlagGroup string
View Source
var FlagName string
View Source
var FlagUser string
View Source
var FlagWorkingDirectory string

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL