changeset 14:855a5e399f6e

change directory struct and docker commands
author taiki
date Wed, 11 Feb 2015 00:34:54 +0900
parents 8e1f57c91210
children 56298c45a7e5
files create.py ie-docker.c ie-docker.h numberfile.py portops.py
diffstat 5 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/create.py	Tue Feb 03 16:49:48 2015 +0900
+++ b/create.py	Wed Feb 11 00:34:54 2015 +0900
@@ -4,7 +4,7 @@
 import argparse
 import portops
 
-base_path = "/media/fcs/docker-hg/"
+base_path = "/home/k138582/docker-hg/"
 
 def ie_mkdir(projectname):
     username = os.getlogin()
--- a/ie-docker.c	Tue Feb 03 16:49:48 2015 +0900
+++ b/ie-docker.c	Wed Feb 11 00:34:54 2015 +0900
@@ -321,7 +321,7 @@
         } else {
             make_ps_name(ps_name, account_type, name, argv[2]);
         }
-        printf("process name3: %s\n", opt->ps_name);
+        printf("process name : %s\n", opt->ps_name);
     }
 
     PSLISTPTR pslist = get_pslist(pattern);
@@ -334,7 +334,7 @@
         print_pslist(pslist);
     } else if (strncmp(argv[1], run_command, 5) == 0) {
 
-        char *args[15];
+        char *args[16];
         int i = 0;
 
         args[i++] = command;
@@ -342,6 +342,8 @@
         if (opt->dettach) args[i++] = "-d";
         if (opt->tty) args[i++] = "-t";
         if (opt->interactive) args[i++] = "-i";
+        args[i++] = "-m";
+        args[i++] = "512m";
         args[i++] = "-v";
         args[i++] = opt->volume;
         args[i++] = "-p";
@@ -370,7 +372,7 @@
             perror("[!] Execv:");
         }
     } else if (strncmp(argv[1], start_command, 5) == 0) {
-        if (execl(command, command, start_command, argv[2], NULL) < 0) {
+        if (execl(command, command, start_command, ps_name,  NULL) < 0) {
             perror("[!] Execl:");
         }
     } else if (strncmp(argv[1], exec_command, 5) == 0) {
@@ -378,7 +380,7 @@
             perror("[!] Execl:");
         }
     } else if ( strncmp(argv[1], stop_command, 4) == 0 ) {
-        if (execl(command, command, stop_command, argv[2], NULL) < 0) {
+        if (execl(command, command, stop_command, ps_name, NULL) < 0) {
             perror("[!] Execl:");
         }
     } else if ( strncmp(argv[1], build_command, 8) == 0 ) {
@@ -386,7 +388,7 @@
             perror("[!] Execl:");
         }
     } else if (strncmp(argv[1], attach_command, 6) == 0 ) {
-        if (execl(command, command, attach_command, NULL) < 0) {
+        if (execl(command, command, attach_command, ps_name, NULL) < 0) {
             perror("[!] Execl:");
         }
     } else if ( strncmp(argv[1], dettach_command, 8) == 0 ) {
--- a/ie-docker.h	Tue Feb 03 16:49:48 2015 +0900
+++ b/ie-docker.h	Wed Feb 11 00:34:54 2015 +0900
@@ -28,7 +28,7 @@
 const char managers_sym[] = "managers";
 const char guests_sym[] = "guests";
 const char delimiter[] = "_";
-const char portlist_file[] = "/crhome/taira/hg/docker-wrapper/iedockerport.list";
+const char portlist_file[] = "/home/k138582/docker-wrapper/iedockerport.list";
 
 enum { 
     NAME_LENGTH = 50,
--- a/numberfile.py	Tue Feb 03 16:49:48 2015 +0900
+++ b/numberfile.py	Wed Feb 11 00:34:54 2015 +0900
@@ -6,10 +6,9 @@
     parser = argparse.ArgumentParser(description='Create new project for ie-docker.')
     parser.add_argument('number', metavar='N', help='start number.')
     parser.add_argument('limit', metavar='N', help='limit number.')
-    parser.add_argument('filename', metavar='filename', help='output file name.')
     args = parser.parse_args()
 
-    f = open(args.filename,"w")
+    f = open("iedockerport.list","w")
     for num in range(int(args.number), int(args.limit)):
         num_str = str(num)
         f.write(num_str + "\n")
--- a/portops.py	Tue Feb 03 16:49:48 2015 +0900
+++ b/portops.py	Wed Feb 11 00:34:54 2015 +0900
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-portlist_file = "/crhome/taira/hg/docker-wrapper/iedockerport.list"
+portlist_file = "/home/k138582/docker-wrapper/iedockerport.list"
 testuser = "testuser"
 delimiter = ","