PageRenderTime 56ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/scheduler.c

https://bitbucket.org/ajithts/mainproject
C | 818 lines | 521 code | 59 blank | 238 comment | 35 complexity | 6f53b6b4c31688dd5bcce37bfafb7dd5 MD5 | raw file
  1. /****************************************************** GRID SCHEDULER ****************************************/
  2. #include<stdio.h>
  3. #include<string.h>
  4. #define MAX 2000000
  5. void command(char[]);
  6. int num,cost;
  7. int nod[4],value=0;
  8. char file[15],rfile[50],temp2[25],file2[100],zip3[25];
  9. void uzip(void);
  10. void rsl(char[]);
  11. char *strrev(char[]);
  12. int top();
  13. main()
  14. {
  15. while(1)
  16. {
  17. int i=0,max=20;
  18. char arg[100],c,cmd[50],tem[25],cos1[20];
  19. for(i=0;i<5;i++)
  20. nod[i]=0;
  21. file[0]='\0';
  22. system("ls -tr ./output/*.zip > zipfile");
  23. i=0;
  24. num=i;
  25. char top[150];
  26. top[0]='\0';
  27. FILE *top1,*top2,*top3,*top4;
  28. top1=fopen("vishnu.out","r");
  29. top2=fopen("globus14.out","r");
  30. top3=fopen("globus16.out","r");
  31. top4=fopen("globus18.out","r");
  32. i=0;
  33. while((c=fgetc(top1))!='\n')
  34. {
  35. cos1[i]=c;//cost of process
  36. i++;
  37. }
  38. cos1[i]='\0';
  39. nod[0]=atoi(cos1);
  40. printf("nod0 value is %d\n",nod[0]);
  41. i=0;
  42. while((c=fgetc(top2))!='\n')
  43. {
  44. cos1[i]=c;//cost of process
  45. i++;
  46. }
  47. cos1[i]='\0';
  48. nod[1]=atoi(cos1);
  49. printf("nod1 value is %d\n",nod[1]);
  50. i=0;
  51. while((c=fgetc(top3))!='\n')
  52. {
  53. cos1[i]=c;//cost of process
  54. i++;
  55. }
  56. cos1[i]='\0';
  57. nod[2]=atoi(cos1);
  58. printf("nod2 value is %d\n",nod[2]);
  59. i=0;
  60. while((c=fgetc(top4))!='\n')
  61. {
  62. cos1[i]=c;//cost of process
  63. i++;
  64. }
  65. cos1[i]='\0';
  66. nod[3]=atoi(cos1);
  67. printf("nod3 value is %d\n",nod[3]);
  68. i=0;
  69. value=nod[i];
  70. for(i=0;i<4;i++)
  71. {
  72. if(value>nod[i])
  73. {
  74. // printf("nod %d value %f\n",i,nod[i]);
  75. value=nod[i]; // value of lowest loaded node...................
  76. num=i;
  77. }
  78. }
  79. //printf("In main num=%d\n",num);
  80. i=0;
  81. uzip();
  82. printf("value is %d cost is %d\n",value,cost);
  83. if((value+cost)<MAX)
  84. {
  85. strcat(arg,rfile);
  86. command(arg);
  87. }
  88. else
  89. {
  90. printf("\nJOB CANNOT BE SCHEDULED !!!!\n");
  91. }
  92. system("rm file");
  93. system("rm zipfile");
  94. // system("rm vishnu.out");
  95. // system("rm globus14.out");
  96. // system("rm globus16.out");
  97. // system("rm globus18.out");
  98. }
  99. }
  100. /****************************************Function for Globus command execution************************************/
  101. void command(char arr[])
  102. {
  103. char cmd[200];
  104. int i,l=0;
  105. char arr2[20],arr3[20],name[20];
  106. arr2[0]='\0';
  107. arr3[0]='\0';
  108. name[0]='\0';
  109. strcat(arr2,arr);
  110. l=strlen(arr2);
  111. printf("arr2=%s\n",arr2);
  112. i=0;
  113. strcat(arr3,temp2);
  114. strcat(arr3,".out");
  115. printf("arr3=%s\n",arr3);
  116. cmd[0]='\0';
  117. if(num+1==1)
  118. {
  119. nod[num]=nod[num]+cost;
  120. strcat(name,"vishnu.local");
  121. printf("name of node is %s\n",name);
  122. strcat(cmd,"globusrun-ws -submit -streaming -F https://");
  123. strcat(cmd,name);
  124. strcat(cmd,":8443/wsrf/services/ManagedJobFactoryService -so /home/globus/mainproject/output/");
  125. strcat(cmd,arr3);
  126. strcat(cmd," -f ");
  127. strcat(cmd,arr2);
  128. printf("globus cmd is :%s\n",cmd);
  129. system(cmd); //!!!!!!!!!!!!Remove comment!!!!!!!!!!!!!!!!!!!!!!!!
  130. }
  131. if(num+1==2)
  132. {
  133. nod[num]=nod[num]+cost;
  134. strcat(name,"globus14.local");
  135. printf("name of node is %s\n",name);
  136. strcat(cmd,"globusrun-ws -submit -streaming -F https://");
  137. strcat(cmd,name);
  138. strcat(cmd,":8443/wsrf/services/ManagedJobFactoryService -so /home/globus/mainproject/output/");
  139. strcat(cmd,arr3);
  140. strcat(cmd," -f ");
  141. strcat(cmd,arr2);
  142. printf("globus cmd is :%s\n",cmd);
  143. system(cmd); //!!!!!!!!!!!!Remove comment!!!!!!!!!!!!!!!!!!!!!!!!
  144. }
  145. if(num+1==3)
  146. {
  147. nod[num]=nod[num]+cost;
  148. strcat(name,"globus16.local");
  149. printf("name of node is %s\n",name);
  150. strcat(cmd,"globusrun-ws -submit -streaming -F https://");
  151. strcat(cmd,name);
  152. strcat(cmd,":8443/wsrf/services/ManagedJobFactoryService -so /home/globus/mainproject/output/");
  153. strcat(cmd,arr3);
  154. strcat(cmd," -f ");
  155. strcat(cmd,arr2);
  156. printf("globus cmd is :%s\n",cmd);
  157. system(cmd); //!!!!!!!!!!!!Remove comment!!!!!!!!!!!!!!!!!!!!!!!!
  158. }
  159. if(num+1==4)
  160. {
  161. nod[num]=nod[num]+cost;
  162. strcat(name,"globus18.local");
  163. printf("name of node is %s\n",name);
  164. strcat(cmd,"globusrun-ws -submit -streaming -F https://");
  165. strcat(cmd,name);
  166. strcat(cmd,":8443/wsrf/services/ManagedJobFactoryService -so /home/globus/mainproject/output/");
  167. strcat(cmd,arr3);
  168. strcat(cmd," -f ");
  169. strcat(cmd,arr2);
  170. printf("globus cmd is :%s\n",cmd);
  171. system(cmd); //!!!!!!!!!!!!Remove comment!!!!!!!!!!!!!!!!!!!!!!!!
  172. }
  173. if(num+1==5)
  174. {
  175. nod[num]=nod[num]+cost;
  176. strcat(name,"vishnu.local");
  177. printf("name of node is %s\n",name);
  178. strcat(cmd,"globusrun-ws -submit -streaming -F https://");
  179. strcat(cmd,name);
  180. strcat(cmd,":8443/wsrf/services/ManagedJobFactoryService -so /home/globus/mainproject/output/");
  181. strcat(cmd,arr3);
  182. strcat(cmd," -f ");
  183. strcat(cmd,arr2);
  184. printf("globus cmd is :%s\n",cmd);
  185. system(cmd); //!!!!!!!!!!!!Remove comment!!!!!!!!!!!!!!!!!!!!!!!!
  186. }
  187. }
  188. /**************************************Function for ZIP DATA*********************************************/
  189. void uzip()
  190. {
  191. char c,*t1,*t2,zip[30],cos[5],temp[25],zip1[50],zip2[50],zip4[25],zip5[25],perl[30],cfile[25],comp[30],fname[25];
  192. char temp3[25],temp4[25],temp5[25];
  193. int i=0,l=0,j=0;
  194. FILE *fp1=NULL,*fp2=NULL,*fp3=NULL,*fp4=NULL;
  195. zip[0]='\0';
  196. zip1[0]='\0';
  197. zip2[0]='\0';
  198. zip3[0]='\0';
  199. zip4[0]='\0';
  200. cfile[0]='\0';
  201. zip5[0]='\0';
  202. perl[0]='\0';
  203. cos[0]='\0';
  204. rfile[0]='\0';
  205. fname[0]='\0';
  206. comp[0]='\0';
  207. fp1=fopen("zipfile","r");//contain zip file names..............
  208. if(fp1==NULL)
  209. printf("NO FILE EXIST!!\n");
  210. else
  211. {
  212. while((c=fgetc(fp1))!='\n')
  213. {
  214. file[i]=c;//select each .zip file
  215. i++;
  216. }
  217. file[i]='\0';
  218. //printf("file is :%s\n",file);
  219. printf("zip file is %s\n",file);
  220. /* i=9;
  221. int j=0;
  222. l=strlen(file);
  223. printf("l=%d\n",l);
  224. while(i<l)
  225. {
  226. fname[j]=file[i];
  227. j++;
  228. i++;
  229. }
  230. fname[j]='\0';
  231. printf("fname is %s\n",fname);
  232. i=0;
  233. l=strlen(fname);
  234. while(fname[i]!='.')
  235. {
  236. zip1[i]=fname[i];
  237. i++;
  238. }
  239. zip1[i]='\0';
  240. printf("zip1 is %s\n",zip1); */
  241. for(i=strlen(file)-1,j=0;file[i]!='/';i--)
  242. {
  243. fname[j]=file[i];
  244. j++;
  245. }
  246. fname[j]='\0';
  247. printf("fname is %s\n",fname);
  248. //while(fname[i]!='.')
  249. //{
  250. // zip1[i]=fname[i];
  251. // i++;
  252. // }
  253. //zip1[i]='\0';
  254. // printf("zip1 is %s\n",zip1);
  255. t1=strrev(fname);
  256. printf("original zip1 name is %s\n",t1);
  257. zip[0]='\0';
  258. strcat(zip,"unzip ");
  259. strcat(zip,file);
  260. printf("zip is %s\n",zip);
  261. //system(zip);// unzip the zip file
  262. //system("rm filelist");
  263. i=0;
  264. temp[0]='\0';
  265. temp2[0]='\0';
  266. strcat(temp,t1);
  267. while(temp[i]!='.')
  268. {
  269. temp2[i]=temp[i];
  270. i++;
  271. }
  272. temp2[i]='\0';
  273. printf("temp is %s\n",temp2);
  274. zip2[0]='\0';
  275. strcat(zip2,"ls ");
  276. strcat(zip2,"./");
  277. strcat(zip2,temp2);
  278. strcat(zip2,"/");
  279. strcat(zip2,"*.c > cpfile");
  280. printf("zip2 is %s\n",zip2);
  281. system(zip2);// Add all .c file names into filelist2
  282. zip2[0]='\0';
  283. strcat(zip2,"ls ");
  284. strcat(zip2,"./");
  285. strcat(zip2,temp2);
  286. strcat(zip2,"/");
  287. strcat(zip2,"*.rsl > rslfile");
  288. system(zip2);
  289. fp2=fopen("cpfile","r");
  290. if(fp2==NULL)
  291. printf("NO FILE EXIST IN FILELIST 2 !!\n");
  292. else
  293. { i=0;
  294. while((c=fgetc(fp2))!='\n')// THERE IS ONLY ONE C FILE ALLOWED ,NO OTHER C FILE DEPENDENCY
  295. {
  296. cfile[i]=c;
  297. i++;
  298. }
  299. cfile[i]='\0';
  300. printf("cfile is %s\n",cfile);
  301. /* i=13;
  302. j=0;
  303. l=strlen(cfile);
  304. printf("l=%d\n",l);
  305. fname[0]='\0';
  306. while(i<l)
  307. {
  308. fname[j]=cfile[i];
  309. j++;
  310. i++;
  311. }
  312. fname[j]='\0';
  313. printf("fname is %s\n",fname);
  314. */
  315. for(i=strlen(cfile)-1,j=0;cfile[i]!='/';i--)
  316. {
  317. fname[j]=cfile[i];
  318. j++;
  319. }
  320. fname[j]='\0';
  321. printf("fname is %s\n",fname);
  322. t2=strrev(fname);
  323. printf("original fname is %s\n",t2);
  324. i=0;
  325. temp3[0]='\0';
  326. strcat(temp3,t2);
  327. while(temp3[i]!='.')
  328. {
  329. zip3[i]=temp3[i];//convert example.c-->example(executable)
  330. i++;
  331. }
  332. zip3[i]='\0';
  333. printf("zip3 is %s\n",zip3);
  334. zip4[0]='\0';
  335. strcat(zip4,"gcc -S ");
  336. //strcat(zip4,zip3);
  337. //strcat(zip4," ");
  338. strcat(zip4,cfile);
  339. printf("zip4 is %s\n",zip4);
  340. system(zip4);
  341. comp[0]='\0';
  342. strcat(comp,"gcc ");
  343. strcat(comp,cfile);
  344. strcat(comp," -o ");
  345. strcat(comp,zip3);
  346. system(comp);
  347. printf("compilation is %s\n",comp);
  348. // system(zip4);// gcc -S example.c (generate assembly file ie., example.s)
  349. zip5[0]='\0';
  350. strcat(zip5,zip3);
  351. strcat(zip5,".s");
  352. perl[0]='\0';
  353. strcat(perl,"perl cost.pl ");
  354. strcat(perl,zip5);
  355. printf("perl is %s\n",perl);
  356. system(perl);// perl cost.pl example.s(To find cost)cost file generated
  357. fp3=fopen("cost","r");
  358. if(fp3==NULL)
  359. printf("NO COST FILE\n");
  360. else
  361. {
  362. i=0;
  363. cos[0]='\0';
  364. while((c=fgetc(fp3))!='\n')
  365. {
  366. cos[i]=c;//cost of process
  367. i++;
  368. }
  369. cos[i]='\0';
  370. cost=atoi(cos);
  371. printf("cost=%d\n",cost);
  372. }
  373. fp4=fopen("rslfile","r");
  374. if(fp4==NULL)
  375. printf("NO RSL FILE\n");
  376. else
  377. {
  378. i=0;
  379. rfile[0]='\0';
  380. while((c=fgetc(fp4))!='\n')
  381. {
  382. rfile[i]=c;
  383. i++;
  384. }
  385. rfile[i]='\0';
  386. printf("rfile is %s\n",rfile);
  387. rsl(rfile);
  388. temp4[0]='\0';
  389. strcat(temp4,"rm ");
  390. strcat(temp4,rfile);
  391. system(temp4);
  392. printf("temp4 is %s\n",temp4);
  393. temp5[0]='\0';
  394. strcat(temp5,"mv ");
  395. strcat(temp5,temp2);
  396. strcat(temp5,".rsl ./");
  397. strcat(temp5,temp2);
  398. strcat(temp5,"/");
  399. system(temp5);
  400. printf("copy is %s\n",temp5);
  401. }
  402. //system("rm filelist2");
  403. //system("perl cost.pl ");
  404. }
  405. }
  406. }
  407. void rsl(char *arr5)
  408. {
  409. FILE *f1=NULL,*f2;
  410. char filename[30],filename1[30],c,*t,source[50]="gsiftp://dayanand.globus/home/globus/mainproject/";
  411. int i=0,j=0,d=0;
  412. printf("arr5 is %s\n",arr5);
  413. char path[100]="/home/globus/mainproject/";
  414. strcat(path,zip3);
  415. strcat(source,arr5);
  416. f1=fopen(arr5,"r");
  417. for(i=strlen(arr5)-1,j=0;arr5[i]!='/';i--)
  418. {
  419. filename[j]=arr5[i];
  420. j++;
  421. }
  422. filename[j]='\0';
  423. printf("filename is %s\n",filename);
  424. t=strrev(filename);
  425. printf("original name is %s\n",t);
  426. f2=fopen(t,"w");
  427. if(f1==NULL)
  428. printf("NO FILE OPERATION\n");
  429. else
  430. {
  431. do
  432. {
  433. c=fgetc(f1);
  434. fprintf(f2,"%c",c);
  435. }while(c!='\n');
  436. do
  437. {
  438. c=fgetc(f1);
  439. fprintf(f2,"%c",c);
  440. }while(c!='>');
  441. fprintf(f2,"%s",path);
  442. while(c=fgetc(f1))
  443. {
  444. if(c=='<')
  445. {
  446. fprintf(f2,"%c",c);
  447. break;
  448. }
  449. }
  450. do
  451. {
  452. c=fgetc(f1);
  453. fprintf(f2,"%c",c);
  454. }while(c!='>');
  455. char p;
  456. /* zip5[0]='\0';
  457. strcat(zip5,zip3);
  458. strcat(zip5,".s");
  459. perl[0]='\0';
  460. strcat(perl,"perl cost.pl ");
  461. strcat(perl,zip5);
  462. */
  463. //..................................................................................
  464. p=fgetc(f1);
  465. printf("charcter=%c",p);
  466. fprintf(f2,"%c",p);
  467. while(p!=EOF){
  468. c=fgetc(f1);
  469. // printf("%c",c);
  470. if(p=='<'){
  471. if(c=='s'){
  472. fprintf(f2,"%c",c);
  473. while(c=fgetc(f1)){
  474. fprintf(f2,"%c",c);
  475. if(c=='>'){
  476. break;
  477. }
  478. }
  479. char c1[50];
  480. c1[0]='\0';
  481. strcat(c1,source);
  482. int i=0;
  483. while(c1[i]!='\0'){
  484. fprintf(f2,"%c",c1[i]);
  485. i++;
  486. }
  487. while(c=fgetc(f1)){
  488. // printf("c is %c\n",c);
  489. if(c=='<'){
  490. fprintf(f2,"%c",c);
  491. break;
  492. }
  493. else{}
  494. }
  495. break;
  496. }
  497. }
  498. fprintf(f2,"%c",c);
  499. p=c;
  500. }
  501. fprintf(f2,"%c",p);
  502. while(p!=EOF){
  503. c=fgetc(f1);
  504. if(p=='<'){
  505. if(c=='d'){
  506. fprintf(f2,"%c",c);
  507. while(c=fgetc(f1)){
  508. fprintf(f2,"%c",c);
  509. if(c=='>'){
  510. break;
  511. }
  512. }
  513. //char c1[]="neeraj";
  514. char c1[50];
  515. if(num+1==1)
  516. {
  517. strcat(c1,"gsiftp://globus14.local/home/guser02/mainproject/Client__code/");
  518. }
  519. if(num+1==2)
  520. {
  521. strcat(c1,"gsiftp://globus15.local/home/guser03/mainproject/Client__code/");
  522. }
  523. if(num+1==3)
  524. {
  525. strcat(c1,"gsiftp://globus16.local/home/guser04/mainproject/Client__code/");
  526. }
  527. if(num+1==4)
  528. {
  529. strcat(c1,"gsiftp://globus18.local/home/guser05/mainproject/Client__code/");
  530. }
  531. if(num+1==5)
  532. {
  533. strcat(c1,"gsiftp:/vishnu.local/home/guser01/mainproject/Client__code/");
  534. }
  535. c1[0]='\0';
  536. int i=0;
  537. while(c1[i]!='\0'){
  538. fprintf(f2,"%c",c1[i]);
  539. i++;
  540. }
  541. while(c=fgetc(f1)){
  542. if(c=='<'){
  543. fprintf(f2,"%c",c);
  544. break;
  545. }
  546. }
  547. break;
  548. }
  549. }
  550. fprintf(f2,"%c",c);
  551. p=c;
  552. }
  553. p=fgetc(f1);
  554. fprintf(f2,"%c",p);
  555. while(c=fgetc(f1)){
  556. if(p=='r'){
  557. if(c=='>'){
  558. //printf("fsdfsdfsdfsdf");
  559. fprintf(f2,"%c",c);
  560. break;
  561. }
  562. }
  563. fprintf(f2,"%c",c);
  564. p=c;
  565. }
  566. while((c=fgetc(f1))!=EOF)
  567. {
  568. fprintf(f2,"%c",c);
  569. }
  570. //.................................................................................................
  571. /* c=fgetc(f1);
  572. fprintf(f2,"%c",c);
  573. i=0;
  574. while((c=fgetc(f1))!=EOF)
  575. {
  576. while(c!='\n')
  577. {
  578. filename1[i]=c;
  579. i++;
  580. c=fgetc(f1);
  581. }
  582. if((d=strcmp(filename1,"<transfer>"))!=0)
  583. fprintf(f2,"%s",filename1);
  584. else
  585. fprintf(f2,"%s",filename1);
  586. } */
  587. fclose(f1);
  588. fclose(f2);
  589. }
  590. }
  591. /***************************************Function for RSL ***********************************************/
  592. /*void rsl(char *arr5)
  593. {
  594. int a,i,j,d=0;
  595. char c,ch,file1[200],arr7[200],nodename[20],filename[30];
  596. FILE *f1=NULL,*f2;
  597. file1[0]='\0';
  598. a=strlen(arr5);
  599. printf("arr5 is %s\n",arr5);
  600. char path[100]="/home/globus/mainproject/";
  601. strcat(path,zip3);
  602. f1=fopen(arr5,"r");
  603. f2=fopen("tmp.txt","w");
  604. if(f1==NULL)
  605. printf("NO FILE EXIST!!\n");
  606. else
  607. {
  608. // printf("11111111111111\n");
  609. while((c=fgetc(f1))!=EOF)
  610. {
  611. i=0;
  612. j=0;
  613. file1[0]='\0';
  614. file2[0]='\0';
  615. nodename[0]='\0';
  616. filename[0]='\0';
  617. arr7[0]='\0';
  618. while(c!='\n')
  619. {
  620. file1[i]=c;
  621. i++;
  622. c=fgetc(f1);
  623. fprintf(f2,"%c",c);
  624. }
  625. fprintf(f2,"\n");
  626. file1[i]='\0';
  627. //printf("file1's content is %s\n",file1);
  628. if((d=strcmp(file1,"<job>"))==0)
  629. { i=0;
  630. while(c=fgetc(f1))
  631. {
  632. fprintf(f2,"%c",c);
  633. if(c=='>')
  634. break;
  635. }
  636. fprintf(f2,"%s",path);
  637. // while((c=fgetc(fp1))!='<')
  638. // {
  639. // file2[i]=c;
  640. // i++;
  641. // }
  642. // file2[i]='\0';
  643. //printf("file2's content is %s\n",file2);
  644. for(i=0;i<16;i++)
  645. {
  646. if(i>7)
  647. {
  648. nodename[j]=file2[i];
  649. j++;
  650. }
  651. else
  652. i++;
  653. }
  654. nodename[j]='\0';
  655. //printf("Nodename=%s\n",nodename);
  656. for(i=strlen(file2)-1,j=0;file2[i]!='/';i--)
  657. {
  658. filename[j]=file2[i];
  659. j++;
  660. }
  661. filename[j]='\0';
  662. //printf("Reversed filename is %s\n",filename);
  663. char *t;
  664. // t=strrev(filename);// Function for string reversal...............
  665. // printf("Original filename is %s\n",t);
  666. strcat(arr7,"globus-url-copy ");
  667. strcat(arr7,file2);
  668. strcat(arr7," gsiftp:///dayanand.globus/home/globus/mainproject/input_files/");//NEED TO CORRECT THE FOLDER
  669. strcat(arr7,nodename); //specify where to copy the file ??????????????
  670. strcat(arr7,"/");
  671. strcat(arr7,t);
  672. //printf("arr7[]=%s\n",arr7);
  673. // system(arr7);
  674. }
  675. }
  676. }
  677. }*/
  678. /***************************************Function for reversing the string**********************************************/
  679. char *strrev(char rev[])
  680. {
  681. int i,j;
  682. char temp[15],a;
  683. temp[0]='\0';
  684. j=strlen(rev)-1;
  685. //or(i=0,j=strlen(rev)-1;j>=0;i++,j--)
  686. for(i=0;j>=0;i++,j--)
  687. {
  688. a=rev[j];
  689. temp[i]=a;
  690. }
  691. j=strlen(rev)-1;
  692. for(i=0;i<=j;i++)
  693. {
  694. rev[i]=temp[i];
  695. }
  696. rev[i]='\0';
  697. return(rev);
  698. }
  699. /***************************Function for redirecting output file into nodes********************************/
  700. /*void redirect()
  701. {
  702. char ch,filename[10],node[10],arr[10];
  703. int i=0;
  704. FILE *fp;
  705. //while(1)
  706. //{
  707. for(i=0;i<10;i++)
  708. {
  709. filename[i]='\0';
  710. node[i]='\0';
  711. arr[i]='\0';
  712. }
  713. system("ls -tr *.out > filelist2"); //create the filelist
  714. fp=fopen("filelist2", "r");
  715. while((ch=fgetc(fp))!='\n') //store the first line of the file in a character array
  716. {
  717. filename[i]=ch;
  718. i++;
  719. }
  720. filename[i]='\0';
  721. rewind(fp);
  722. i=0;
  723. while((ch=fgetc(fp))!='_') // store the node name in a character array
  724. {
  725. node[i]=ch;
  726. i++;
  727. }
  728. node[i]='\0';
  729. // printf("Hello"); // send the file to the corresponding node
  730. if((i=strcmp(node,"node1"))==0)
  731. system("globus-url-copy file://serverhostname gsiftp:// clientpath");
  732. i++;
  733. else if((i=strcmp(node,"node2"))==0)
  734. // system("globus-url-copy file://serverhostname gsiftp:// clientpath");
  735. i++;
  736. else if((i=strcmp(node,"node3"))==0)
  737. // system("globus-url-copy file://serverhostname gsiftp:// clientpath");
  738. i++;
  739. else if((i=strcmp(node,"node4"))==0)
  740. // system("globus-url-copy file://serverhostname gsiftp:// clientpath");
  741. //
  742. i++;
  743. else if((i=strcmp(node,"node5"))==0)
  744. // system("globus-url-copy file://serverhostname gsiftp:// clientpath");
  745. //
  746. i++;
  747. else
  748. printf("Error while redirecting\n");
  749. //}
  750. strcat(arr,"rm ");
  751. strcat(arr,node);
  752. system(arr);
  753. }*/