# HG changeset patch # User ethanzonca@localhost.localdomain # Date 2009-07-01 13:07:16 # Node ID bb3ccc3030b42e65205fcbb1460f7b7a0d7dee24 # Parent d3ee86d58ec1f4b4e97948c1365facfc1c1c0c21 Added some user-adding, it\'s interactive for testing purposes. I\'ll make it non-interactive soon if I am not beaten to the task diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -28,11 +28,15 @@ #include #include "execio.h" + +// needs to be implemented #include "options.h" + #include #define max 100 - // maximum number of stored jobs in memory, per job type (lux/blend). Eventually we can dump this data to disk, or atleast the remainder not in memory... +// maximum number of stored jobs in memory, per job type (lux/blend). Eventually we can dump this data to disk, or atleast the remainder not in memory... + int jobnum = 0; // Structures for storing job information @@ -66,9 +70,11 @@ int main(int argc, char *argv[]) // We need the conf parser code from options.c here!!! -char *username = "unregistered"; +// Registered checker, needs input from conf file to see if the default username exists +char *username = "unregistered"; // get this from conf int registered; if(username == "unregistered") { + fprintf(stderr,"You have not set your username in distrend.conf!\nIf you need to register a username, run distrend --createuser=username"); // This is what it should maybe be like lol... registered = 0; } @@ -77,12 +83,13 @@ if(username == "unregistered") { // Registration on server. Needs attention. (e.g., people could make tons of accounts with the key we give them... +// This should really not be an interactive process... after contemplation, a user should run distrend --createuser=username which does this, or something. But we must prevent multi-user-creation abuse, too. if(registered==0) { char newusername[100]; - fprintf(stderr, "Please enter your desired username: "); + fprintf(stderr, "**** Please enter your desired username: "); fgets(newusername,100,stdin); - fprintf(stderr, "\nChecking availibility of username: %s\n\n",newusername); + fprintf(stderr, "\n**** Checking availibility of username: %s\n",newusername); // Mostly kinda copied from old code, but I understand it a tad better now :) // Logs into sandboxed user on zserver2 and registers a user char buf[10]; @@ -95,25 +102,27 @@ char newusername[100]; "setup.rsa", "-p", "23", - "sh", - "-c", "sudo /usr/sbin/useradd", "-M", "-c", "email", "-d", "/home/distren", - "--gid 537", + "--gid", + "541", newusername, (char *)NULL }; size_t readlen; - fprintf(stderr, "execio_open:", execio_open(&testrem, "ssh", execargv)); + fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv)); buf[9] = '\0'; // null-terminating the array... while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff? { if(readlen > 9) { - fprintf(stderr, "Something is terribly wrong!\n"); + fprintf(stderr, "**** Something is terribly wrong!\n"); + } + if(buf == 0) { + fprintf(stderr, "**** Operation successful, or so we hope. We got no output."); } buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is? fprintf(stderr, "read \"%s\"\n", buf); @@ -127,6 +136,11 @@ else{ + + + + + /* frame[frame] Assignments: "0" - cancelled @@ -137,7 +151,6 @@ else{ Then we will need some sort of watchdog to monitor slaves on the main server to check for stales. */ - // Queuer: this function should add files to the queue // Type: 0 = blender, 1 = luxrender // jobnum is the current job number @@ -174,9 +187,11 @@ jobnum++; -///////////////////////// SLAVE /////////////////////////////// /* +Slave execution code lies below + + Slave listens on server for a command in the format of each function... We need if's for returns... ==> watchdog */