-
Notifications
You must be signed in to change notification settings - Fork 2
/
submitopar_script_template.sh
executable file
·73 lines (59 loc) · 1.33 KB
/
submitopar_script_template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /bin/bash
# version 1.1 June 2017 (O.B.)
#
# OPAR Data Center maintained by
# Olivier Becker (olivier.becker@obspm.fr)
# Teddy Carlucci (teddy.carlucci@obspm.fr)
# Christophe Barache (christophe.barache@obspm.fr)
# Sebastien Lambert (sebastien.lambert@obspm.fr)
#
LOGIN=""
PASSWD=""
user=$LOGIN:$PASSWD
function usage_example
{
echo ""
echo "USAGE EXAMPLE :"
echo ""
echo "submitopar_script -display"
echo ""
echo " display remote directory ssalto"
echo ""
echo "submitopar_script -upload file1 file2 file3"
echo ""
echo " upload local file1 file2 file3 to ivsopar"
echo ""
exit
}
if [ $# -eq 0 ]
then
usage_example
fi
mode=$1
if [ $mode != "-display" ] && [ $mode != "-upload" ]
then
usage_example
fi
case $mode in
"-display" )
if [ $# -ne 1 ]
then
usage_example
fi
curl -u $user -F 'mode=display' https://ivsopar.obspm.fr/upload/
;;
"-upload" )
for fichier in $@
do
if [ $fichier != "$1" ]
then
if [ -f $fichier ]
then
curl -u $user -F "fichier=@"$fichier -F 'mode=upload' https://ivsopar.obspm.fr/upload/
else
echo "Error. Can't upload $fichier"
fi
fi
done
;;
esac