erreur : syntax error near unexpected token
Bonjour, j'ai un message erreur quand j'essaye executer mon script
erreur :
Code:
1 2
| ./install_linux.sh: line 1: syntax error near unexpected token `<'
./install_linux.sh: line 1: `<html><head>' |
et voici le contenu de install_linux.sh
Code:
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
| #!/bin/bash
#####################
# installation script
#####################
#VARS
ME=`whoami`
ok="\E[32;40m Ok \E[37;40m"
failed="\E[31;40m Failed \E[37;40m"
ip=`ifconfig eth0 | grep inet | cut -d ":" -f2 | cut -d " " -f1`
################
# Check for root
################
if [ $ME != "root" ] ; then
echo "Program must be ran as the user root."
exit 0
fi
echo -e "";
echo -e "This script will install all necaissary files!";
echo -e "";
################
## Sub functions
################
show_error () {
error_message=${1:-$default_msg}
command=${2:-"NONE"}
echo ""
echo "An error has occurred!" $red $underline
echo "Error: $error_message" $red
if [ "$command" != "NONE" ] ; then
echo "Typical Fix/Command: yum install $command (FC/RH)"
echo "Typical Fix/Command: apt-get install $command (Debian)"
fi
echo ""
exit -1
}
#########################
### Dependency Checks ###
#########################
#echo "Script will check depencies!";
#if [ "$PWD" == "/usr/gscp" ]; then
# echo -e " The script location: [ $ok ]"
#else
# echo -e " The script location: [ $failed ]"
# show_error "This script has to be run from: /usr/gscp"
#fi
#WHICH
if which bc &> /dev/null; then
echo -e " The 'which' package: [ $ok ]"
else
echo -e " The 'which' package: [ $failed ]"
show_error "The 'which' program/package is not installed" "which"
fi
if which wget bc &> /dev/null; then
echo -e " The 'wget' package: [ $ok ]"
else
echo -e " The 'wget' package: [ $failed ]"
show_error "The 'wget' program/package is not installed" "wget"
fi
if which tar bc &> /dev/null; then
echo -e " The 'tar' package: [ $ok ]"
else
echo -e " The 'tar' package: [ $failed ]"
show_error "The 'tar' program/package is not installed" "tar"
fi
if which screen bc &> /dev/null; then
echo -e " The 'screen' package: [ $ok ]"
else
echo -e " The 'screen' package: [ $failed ]"
show_error "The 'screen' program/package is not installed" "screen"
fi
#test=`ls -a /usr/ | grep jdk1.*`
#if [ "$test" != "" ]; then
# echo -e " The 'java' package: [ $ok ]"
#else
# echo -e " The 'java' package: [ $failed ]"
# show_error "The 'Java' program/package is not installed (see GSCP manual for more info)"
#fi
######################
## READY TO INSTALL ##
######################
echo -e ""
echo -e "#####################################"
echo -e "## Deamon will be installed now! ##"
echo -e "#####################################"
echo -e ""
echo -e "Installing Java JDK!"
echo -e "To complete the installation of Java JDK you'll have to accept the licence!"
echo -e ""
echo -e "JDK installation will start in 10 seconds"
sleep 10s
cd /usr/
if [ -e /usr/lib64 ]; then
wget http://www.gccontrol.com/software/jdk-1_5_0_11-linux-amd64.bin
chmod a+x jdk-1_5_0_11-linux-amd64.bin
./jdk-1_5_0_11-linux-amd64.bin
rm jdk-1_5_0_11-linux-amd64.bin
else
wget http://www.gccontrol.com/software/jdk-1_5_0_11-linux-i586.bin
chmod a+x jdk-1_5_0_11-linux-i586.bin
./jdk-1_5_0_11-linux-i586.bin
rm jdk-1_5_0_11-linux-i586.bin
fi
#chmod -R 660 *
#chmod 770 */*.sh
#chmod 770 */*/*.sh
echo -e "Java JDK has been installed successfully!"
echo -e ""
echo -e "Installing GSCP deamon!"
echo -e ""
mkdir /usr/gscp/
cd /usr/gscp/
wget http://www.gccontrol.com/software/gscp.tar.gz
tar xzvf gscp.tar.gz
rm gscp.tar.gz
echo -e ""
echo -e "Please fill in the username and password to secure your GSCP deamon"
echo -e ""
#########################
# Ask for username deamon
#########################
found=true;
while [ $found == true ]; do
printf "Deamon username: "
if [ "$deamon_username" == "" ]; then
read deamon_username
fi
if [ "$deamon_username" != "" ]; then
found=false
fi
done
#sed -e s/F1/$deamon_username/ conf/tomcat-users.xml > conf/tomcat-users.conf
#########################
# Ask for password deamon
#########################
found=true;
while [ $found == true ]; do
printf "Deamon password: "
if [ "$deamon_password" == "" ]; then
read deamon_password
fi
if [ "$deamon_password" != "" ]; then
found=false
fi
done
sed -e s/FIELD1/$deamon_username/ -e s/FIELD2/$deamon_password/ conf/tomcat-users.xml.orig > conf/tomcat-users.xml
chmod -R 660 /usr/gscp/*
chmod 770 /usr/gscp/*/*.sh
chmod 770 /usr/gscp/*/*/*.sh
#################################
#Install autostart
#################################
wget http://www.gccontrol.com/software/gscp_deamon.sh
mv gscp_deamon.sh /etc/init.d/gscp_deamon.sh
chmod a+x /etc/init.d/gscp_deamon.sh
ln -s /etc/init.d/gscp_deamon.sh /etc/rc2.d/S91_gscp_deamon
ln -s /etc/init.d/gscp_deamon.sh /etc/rc3.d/S91_gscp_deamon
ln -s /etc/init.d/gscp_deamon.sh /etc/rc5.d/S91_gscp_deamon
###############
#Deamon starten
###############
/etc/init.d/gscp_deamon.sh start
###############
#Info weergeven
###############
echo -e ""
echo -e ""
echo -e "Your system is ready to use GSCP deamon!";
echo -e ""
echo -e "Deamon ip: " $ip
echo -e "Deamon port: 8843"
echo -e "Deamon username: $deamon_username"
echo -e "Deamon password: $deamon_password" |
Merci infiniment pour votre aide !