gyrojeff commited on
Commit
f329bf7
·
1 Parent(s): c34db03

feat: add linux batch script

Browse files
Files changed (2) hide show
  1. .gitignore +4 -0
  2. batch_generate_script_linux.c +45 -0
.gitignore CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  wordlist.txt
2
  dataset
3
  lyrics_corpus/cache
 
1
+ *.o
2
+ *.out
3
+
4
+
5
  wordlist.txt
6
  dataset
7
  lyrics_corpus/cache
batch_generate_script_linux.c ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <sys/wait.h>
4
+ #include <unistd.h>
5
+ #include <string.h>
6
+
7
+ #define MAX_DIGIT 10
8
+
9
+
10
+ int total_mission = 64;
11
+ int min_mission = 33;
12
+ int max_mission = 48;
13
+
14
+
15
+ int main(int argc, char* argv[]) {
16
+ for (int i = min_mission; i <= max_mission; i ++) {
17
+ int pid = fork();
18
+ if (pid < 0) {
19
+ perror("fork");
20
+ }
21
+ if (pid == 0) {
22
+ char batch_number[MAX_DIGIT];
23
+ char batch_count[MAX_DIGIT];
24
+
25
+ memset(batch_number, '\0', MAX_DIGIT * sizeof(char));
26
+ memset(batch_count, '\0', MAX_DIGIT * sizeof(char));
27
+
28
+ sprintf(batch_number, "%d", i);
29
+ sprintf(batch_count, "%d", total_mission);
30
+
31
+ char *cmd = "./venv/bin/python";
32
+ char *args[] = {"./venv/bin/python", "font_ds_generate_script.py", batch_number, batch_count, NULL};
33
+
34
+ if (execvp(cmd, args) < 0) {
35
+ perror("execvp");
36
+ }
37
+ }
38
+ }
39
+
40
+ pid_t wpid;
41
+ int status = 0;
42
+ while ((wpid = wait(&status)) > 0) {}
43
+ return 0;
44
+ }
45
+