Skip to content

Instantly share code, notes, and snippets.

@Halo-Michael
Created November 16, 2020 09:33
Show Gist options
  • Save Halo-Michael/cb91988a17cd5766d4c90545231a1e0f to your computer and use it in GitHub Desktop.
Save Halo-Michael/cb91988a17cd5766d4c90545231a1e0f to your computer and use it in GitHub Desktop.
run /etc/rc.d
#import <Foundation/Foundation.h>
#import <Foundation/NSTask.h>
int main(){
for (NSString *file in [[NSFileManager defaultManager] subpathsAtPath:@"/etc/rc.d"]) {
NSString *path = [@"/etc/rc.d/" stringByAppendingString:file];
if ([[NSFileManager defaultManager] isExecutableFileAtPath:path]) {
[[NSTask launchedTaskWithLaunchPath:path arguments:@[]] waitUntilExit];
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment