shell 脚本更新azkaban job
#!/bin/bash
set -e
zip_name=clear_nginx_logs.zip
project_name=clear_nginx_logs
cd `dirname $0`
cpath=`pwd`
cd $cpath
rm -rf ${zip_name}
zip ./${zip_name} ./poi/gd/*.job ./aoi/gd/*.job ./poi/dzdp/*.job
resp1=$(curl -k -X POST --data 'action=login&username=azkaban&password=azkaban!@#$' https://ip:8443)
echo $resp1
resp2=`echo $resp1| sed s/session.id/session_id/g`
echo $resp2
sid=`echo $resp2|jq '.session_id'`
session_id=`echo $sid|sed s/\"//g`
echo $session_id
up_resp=$(curl -k -i -H "Content-Type: multipart/mixed" -X POST --form 'session.id='$session_id --form 'ajax=upload' --form 'file=@geo_aoi_gd.zip;type=application/zip' --form 'project=geo' https://ip:8443/manager)
echo $up_resp
rm -rf ${zip_name}