this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

simplify service name on linux

pomdtr 45ae5b46 265377d5

+20 -20
+20 -20
cmd/service_linux.go
··· 22 22 23 23 func getServicePath(uid int) string { 24 24 if uid == 0 { 25 - return path.Join("/etc", "systemd", "system", "com.github.pomdtr.smallweb.service") 25 + return path.Join("/etc", "systemd", "system", "smallweb.service") 26 26 } 27 27 28 - return path.Join(os.Getenv("HOME"), ".config", "systemd", "user", "com.github.pomdtr.smallweb.service") 28 + return path.Join(os.Getenv("HOME"), ".config", "systemd", "user", "smallweb.service") 29 29 } 30 30 31 31 func InstallService(args []string) error { ··· 69 69 return fmt.Errorf("failed to reload systemd manager configuration: %v", err) 70 70 } 71 71 72 - if err := exec.Command("systemctl", "enable", "com.github.pomdtr.smallweb").Run(); err != nil { 72 + if err := exec.Command("systemctl", "enable", "smallweb").Run(); err != nil { 73 73 return fmt.Errorf("failed to enable service: %v", err) 74 74 } 75 75 76 - if err := exec.Command("systemctl", "start", "com.github.pomdtr.smallweb").Run(); err != nil { 76 + if err := exec.Command("systemctl", "start", "smallweb").Run(); err != nil { 77 77 return fmt.Errorf("failed to start service: %v", err) 78 78 } 79 79 ··· 86 86 } 87 87 88 88 // Enable the service to start on boot 89 - if err := exec.Command("systemctl", "--user", "enable", "com.github.pomdtr.smallweb").Run(); err != nil { 89 + if err := exec.Command("systemctl", "--user", "enable", "smallweb").Run(); err != nil { 90 90 return fmt.Errorf("failed to enable service: %v", err) 91 91 } 92 92 93 93 // Start the service immediately 94 - if err := exec.Command("systemctl", "--user", "start", "com.github.pomdtr.smallweb").Run(); err != nil { 94 + if err := exec.Command("systemctl", "--user", "start", "smallweb").Run(); err != nil { 95 95 return fmt.Errorf("failed to start service: %v", err) 96 96 } 97 97 ··· 106 106 } 107 107 108 108 if uid == 0 { 109 - if err := exec.Command("systemctl", "start", "com.github.pomdtr.smallweb").Run(); err != nil { 109 + if err := exec.Command("systemctl", "start", "smallweb").Run(); err != nil { 110 110 return fmt.Errorf("failed to start service: %v", err) 111 111 } 112 112 113 113 return nil 114 114 } 115 115 116 - if err := exec.Command("systemctl", "--user", "start", "com.github.pomdtr.smallweb").Run(); err != nil { 116 + if err := exec.Command("systemctl", "--user", "start", "smallweb").Run(); err != nil { 117 117 return fmt.Errorf("failed to start service: %v", err) 118 118 } 119 119 ··· 128 128 } 129 129 130 130 if uid == 0 { 131 - if err := exec.Command("systemctl", "stop", "com.github.pomdtr.smallweb").Run(); err != nil { 131 + if err := exec.Command("systemctl", "stop", "smallweb").Run(); err != nil { 132 132 return fmt.Errorf("failed to stop service: %v", err) 133 133 } 134 134 135 135 return nil 136 136 } 137 137 138 - if err := exec.Command("systemctl", "--user", "stop", "com.github.pomdtr.smallweb").Run(); err != nil { 138 + if err := exec.Command("systemctl", "--user", "stop", "smallweb").Run(); err != nil { 139 139 return fmt.Errorf("failed to stop service: %v", err) 140 140 } 141 141 ··· 150 150 } 151 151 152 152 if uid == 0 { 153 - if err := exec.Command("systemctl", "restart", "com.github.pomdtr.smallweb").Run(); err != nil { 153 + if err := exec.Command("systemctl", "restart", "smallweb").Run(); err != nil { 154 154 return fmt.Errorf("failed to restart service: %v", err) 155 155 } 156 156 157 157 return nil 158 158 } 159 159 160 - if err := exec.Command("systemctl", "--user", "restart", "com.github.pomdtr.smallweb").Run(); err != nil { 160 + if err := exec.Command("systemctl", "--user", "restart", "smallweb").Run(); err != nil { 161 161 return fmt.Errorf("failed to restart service: %v", err) 162 162 } 163 163 ··· 172 172 } 173 173 174 174 if uid == 0 { 175 - if err := exec.Command("systemctl", "stop", "com.github.pomdtr.smallweb").Run(); err != nil { 175 + if err := exec.Command("systemctl", "stop", "smallweb").Run(); err != nil { 176 176 return fmt.Errorf("failed to stop service: %v", err) 177 177 } 178 178 179 - if err := exec.Command("systemctl", "disable", "com.github.pomdtr.smallweb").Run(); err != nil { 179 + if err := exec.Command("systemctl", "disable", "smallweb").Run(); err != nil { 180 180 return fmt.Errorf("failed to disable service: %v", err) 181 181 } 182 182 ··· 192 192 } 193 193 194 194 // Stop the service if it is running 195 - if err := exec.Command("systemctl", "--user", "stop", "com.github.pomdtr.smallweb").Run(); err != nil { 195 + if err := exec.Command("systemctl", "--user", "stop", "smallweb").Run(); err != nil { 196 196 return fmt.Errorf("failed to stop service: %v", err) 197 197 } 198 198 199 199 // Disable the service so it doesn't start on boot 200 - if err := exec.Command("systemctl", "--user", "disable", "com.github.pomdtr.smallweb").Run(); err != nil { 200 + if err := exec.Command("systemctl", "--user", "disable", "smallweb").Run(); err != nil { 201 201 return fmt.Errorf("failed to disable service: %v", err) 202 202 } 203 203 ··· 216 216 func PrintServiceLogs(follow bool) error { 217 217 uid := os.Getuid() 218 218 if uid == 0 { 219 - logCmdArg := []string{"com.github.pomdtr.smallweb"} 219 + logCmdArg := []string{"smallweb"} 220 220 if follow { 221 221 logCmdArg = append(logCmdArg, "-f") 222 222 } ··· 231 231 return nil 232 232 } 233 233 234 - logCmdArgs := []string{"--user", "--user-unit", "com.github.pomdtr.smallweb"} 234 + logCmdArgs := []string{"--user", "--user-unit", "smallweb"} 235 235 if follow { 236 236 logCmdArgs = append(logCmdArgs, "-f") 237 237 } ··· 250 250 uid := os.Getuid() 251 251 252 252 if uid == 0 { 253 - statusCmd := exec.Command("systemctl", "status", "com.github.pomdtr.smallweb") 253 + statusCmd := exec.Command("systemctl", "status", "smallweb") 254 254 statusCmd.Stdout = os.Stdout 255 255 statusCmd.Stderr = os.Stderr 256 256 if err := statusCmd.Run(); err != nil { ··· 259 259 return nil 260 260 } 261 261 262 - statusCmd := exec.Command("systemctl", "--user", "status", "com.github.pomdtr.smallweb") 262 + statusCmd := exec.Command("systemctl", "--user", "status", "smallweb") 263 263 statusCmd.Stdout = os.Stdout 264 264 statusCmd.Stderr = os.Stderr 265 265 if err := statusCmd.Run(); err != nil {