@@ -71,6 +71,7 @@ func (j *Job) createSystemdJob(unitType systemd.UnitType) error {
71
71
if err != nil {
72
72
return err
73
73
}
74
+ fmt .Println ("" )
74
75
// display a status after starting it
75
76
_ = runSystemctlCommand (timerName , commandStatus , unitType )
76
77
@@ -134,7 +135,25 @@ func (j *Job) displaySystemdStatus(command string) error {
134
135
return runSystemctlCommand (timerName , commandStatus , systemd .UserUnit )
135
136
}
136
137
138
+ // displaySystemdStatus displays the status of all the timers installed on that profile
139
+ func displaySystemdStatus (profile string ) error {
140
+ timerName := fmt .Sprintf ("resticprofile-*@profile-%s.timer" , profile )
141
+ args := []string {"list-timers" , "--all" , "--no-pager" , timerName }
142
+ // if unitType == systemd.UserUnit {
143
+ // args = append(args, flagUserUnit)
144
+ // }
145
+ cmd := exec .Command (systemctlBin , args ... )
146
+ cmd .Stdout = os .Stdout
147
+ cmd .Stderr = os .Stderr
148
+ err := cmd .Run ()
149
+ fmt .Println ("" )
150
+ return err
151
+ }
152
+
137
153
func runSystemctlCommand (timerName , command string , unitType systemd.UnitType ) error {
154
+ if command == commandStatus {
155
+ fmt .Print ("Systemd timer status\n =====================\n " )
156
+ }
138
157
args := make ([]string , 0 , 3 )
139
158
if unitType == systemd .UserUnit {
140
159
args = append (args , flagUserUnit )
@@ -158,8 +177,9 @@ func runSystemctlCommand(timerName, command string, unitType systemd.UnitType) e
158
177
}
159
178
160
179
func runJournalCtlCommand (timerName string , unitType systemd.UnitType ) error {
180
+ fmt .Print ("Recent log (>= warning in the last month)\n ==========================================\n " )
161
181
timerName = strings .TrimSuffix (timerName , ".timer" )
162
- args := []string {"--since" , "1 month ago" , "--no-pager" , "--priority" , "err " , "--unit" , timerName }
182
+ args := []string {"--since" , "1 month ago" , "--no-pager" , "--priority" , "warning " , "--unit" , timerName }
163
183
if unitType == systemd .UserUnit {
164
184
args = append (args , flagUserUnit )
165
185
}
0 commit comments