File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ export function isActive(unitName: string, unit?: Unit) {
126
126
return execSync ( `systemctl is-active ${ name } .${ type } ` ) . toString ( ) . trim ( ) === "active" ;
127
127
}
128
128
129
+ export function isEnabled ( unitName : string , unit ?: Unit ) {
130
+ const type = getType ( unitName , unit ) ;
131
+ const name = getName ( unitName ) ;
132
+
133
+ return execSync ( `systemctl is-enabled ${ name } .${ type } ` ) . toString ( ) . trim ( ) === "enabled" ;
134
+ }
135
+
129
136
export class Ctl {
130
137
private readonly type : string ;
131
138
private readonly name : string ;
@@ -190,4 +197,8 @@ export class Ctl {
190
197
public isActive ( ) {
191
198
return isActive ( this . name , this . unit ) ;
192
199
}
200
+
201
+ public isEnabled ( ) {
202
+ return isEnabled ( this . name , this . unit ) ;
203
+ }
193
204
}
Original file line number Diff line number Diff line change 8
8
start ,
9
9
stop ,
10
10
restart ,
11
+ isActive ,
12
+ isEnabled ,
11
13
} from "./ctl.js" ;
You can’t perform that action at this time.
0 commit comments