Thursday, 7 July 2011

GridFTP on Archlinux

After having globus-gridftp-server and myproxy-server work on Gentoo linux, it was easy to convert the scripts to work on Arch linux. Following their guide, I tried myproxy-server at first and it worked nicely. Actually in their guide they should mention about ensuring that the executable is in PATH.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

GLOBUS_LOCATION=/home/phoenix/gt
DAEMON=myproxy-server
ARGS=

[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON

PID=$(pidof -o %PPID $DAEMON)

case "$1" in
 start)
   stat_busy "Starting $DAEMON"
   [ -z "$PID" ] && $GLOBUS_LOCATION/sbin/$DAEMON $ARGS &>/dev/null
   if [ $? = 0 ]; then
     add_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 stop)
   stat_busy "Stopping $DAEMON"
   [ -n "$PID" ] && kill $PID &>/dev/null
   if [ $? = 0 ]; then
     rm_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}" 
esac


Now, getting the script for the gridftp-server working was a bit tricky as I had to pass the parameter for the port number and also to get it work as a daemon. I tried to provide the parameters from /etc/conf.d/gridftp-server; but somehow it was not reading the parameters from that file so I had to provide it in the rc script itself.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

export GLOBUS_LOCATION=/homephoenix/gt
export LD_LIBRARY_PATH=$GLOBUS_LOCATION/lib
source $GLOBUS_LOCATION/etc/globus-user-env.sh
DAEMON=globus-gridftp-server
ARGS="-S -f -p 2811"

[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON

PID=$(pidof -o %PPID $DAEMON)

case "$1" in
 start)
   stat_busy "Starting $DAEMON"
   [ -z "$PID" ] && $GLOBUS_LOCATION/sbin/$DAEMON $ARGS &>/dev/null
   if [ $? = 0 ]; then
     add_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 stop)
   stat_busy "Stopping $DAEMON"
   [ -n "$PID" ] && kill $PID &>/dev/null
   if [ $? = 0 ]; then
     rm_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}" 
esac

No comments: