Hardcoded config required for planetflow. This is temporary, till NodeManager impleme...
authorSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 25 Feb 2008 15:40:04 +0000 (15:40 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 25 Feb 2008 15:40:04 +0000 (15:40 +0000)
vsys-initscript
vsys.spec
vsyssh/vsyssh.c

index 58eb450..8490147 100755 (executable)
@@ -38,6 +38,7 @@ case "$1" in
     stop)
         echo -n "Stopping $name:"
         killproc $name
+        killproc $name
         RETVAL=$?
         echo
         [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
index 777c1f3..81a9f93 100644 (file)
--- a/vsys.spec
+++ b/vsys.spec
@@ -49,6 +49,8 @@ make
 %install
 mkdir -p $RPM_BUILD_ROOT/usr/bin
 mkdir -p $RPM_BUILD_ROOT/etc/init.d
+mkdir -p $RPM_BUILD_ROOT/vsys
+cp factory/* $RPM_BUILD_ROOT/vsys
 cp vsys $RPM_BUILD_ROOT/usr/bin
 cp vsys-initscript $RPM_BUILD_ROOT/etc/init.d/vsys
 
@@ -58,6 +60,7 @@ rm -rf $RPM_BUILD_ROOT
 %files
 /usr/bin/vsys
 /etc/init.d/vsys
+/vsys/*
 
 %post
 chkconfig --add vsys
index 105f565..9deb5ba 100644 (file)
 int main(int argc, char **argv, char **envp)
 {
        if (argc<2) {
-               printf("Usage: vsyssh <vsys entry> <cmd>\n");
+               printf("Usage: vsyssh <vsys entry> [cmd]\n");
                exit(1);
        }
        else {
                int vfd0,vfd1;
                char *inf,*outf;
+               struct timeval tv;
+
                inf=(char *)malloc(strlen(argv[1])+3);
-               outf=(char *)malloc(strlen(argv[2])+4);
+               outf=(char *)malloc(strlen(argv[1])+4);
                strcpy(inf,argv[1]);
-               strcpy(outf,argv[2]);
+               strcpy(outf,argv[1]);
                strcat(inf,".in");
                strcat(outf,".out");
+               tv.tv_sec = 100;
+               tv.tv_usec = 0;
 
-               vfd1 = open(inf,O_WRONLY);
-               vfd0 = open(outf,O_RDONLY);
+               vfd1 = open(inf,O_WRONLY|O_NONBLOCK);
+               vfd0 = open(outf,O_RDONLY|O_NONBLOCK);
 
                if (vfd0==-1 || vfd1 == -1) {
                        printf("Error opening vsys entry %s\n", argv[1]);
                        exit(1);
                }
 
-               
                if (argc<3) {
                        fd_set set;
                        FD_ZERO(&set);
-                       FD_SET(0,&set);
-                       FD_SET(vfd0,&set);
+                       FD_SET(0, &set);
+                       FD_SET(vfd0, &set);
+
                        while (1) {
                                int ret;
-                               ret = select(2, &set, NULL, NULL, NULL);
+                               printf("vsys>");
+                               ret = select(vfd0+1, &set, NULL, NULL, &tv);
                                if (FD_ISSET(0,&set)) {
                                        char lineread[2048];
                                        int ret;