Advertisement
erodemobiles

Post

May 2nd, 2011
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. # config here:
  5. MS_MAPFILE="bmn1.map"
  6. MAPSERVER_BINARY="mapserv"
  7.  
  8. # print usage
  9. if [ $# -lt 1 ]
  10. then
  11.     echo "usage: $0 [filename]"  >&2
  12.     exit 1
  13. fi
  14.  
  15. # check if desired file exists
  16. FILE=$1
  17. #!/bin/sh
  18.  
  19.  
  20. # config here:
  21. MS_MAPFILE="bmn1.map"
  22. MAPSERVER_BINARY="mapserv"
  23.  
  24. # print usage
  25. if [ $# -lt 1 ]
  26. then
  27.     echo "usage: $0 [filename]"  >&2
  28.     exit 1
  29. fi
  30.  
  31. # check if desired file exists
  32. FILE=$1
  33. if [ -r $FILE ]
  34. then
  35.     # find out size of file
  36.     size=$(stat -c %s $FILE)
  37.        
  38.     # set needed values
  39.     REQUEST_METHOD=POST
  40.     export REQUEST_METHOD
  41.     CONTENT_LENGTH=$size
  42.     export CONTENT_LENGTH
  43.     export MS_MAPFILE
  44.    
  45.     # execute mapserver
  46.    
  47.     cat $1 | $MAPSERVER_BINARY
  48.    
  49.     ######## DEBUG ##########
  50.     #gdb $MAPSERVER_BINARY
  51.     #cat $1 > fifo &
  52.    
  53. else
  54.     echo "File $FILE does not exist."  >&2
  55.     exit 1
  56. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement