
mkdir -p log

if [ -f $1 ]
then
    chmod +x $1
else
   echo "${1} not exist"
   exit -1
fi

script_str=$(echo $1 | tr /. _)
args_str=$(echo $(IFS="_"; echo "${*:2}") | tr /. _)

echo $args_str
if [ -z "$args_str" ]; then
   log_file=log/${script_str}.log
else
   log_file=log/${script_str}.${args_str}.log
fi

time=$(date "+%Y%m%d-%H%M%S")
if [ -f $log_file ]
then
    cp $log_file ${log_file}.${time}
fi

nohup ./$1 ${*:2}  > $log_file 2>&1&
echo $log_file

