URL: https://www.opennet.me/cgi-bin/openforum/vsluhboard.cgi
Форум: vsluhforumID9
Нить номер: 9837
[ Назад ]

Исходное сообщение
"Помогите! syntax error: unexpected end of file bash "

Отправлено vadian72 , 10-Мрт-14 10:11 
Всем привет. Со скриптами не очень дружу вопрос к спецам скрипт при запуске выдаёт ошибку:  /usr/local/bin/anticat.sh: line 25: syntax error: unexpected end of file это на Debian 6.0 сам скрипт писал не я где поправить спасибо вот:

#!/bin/bash
a=1
while [ $a -eq 1 ]
do
#проверяем каждые 5 сек жив ли grs в течении 1 минуты
b=1
while [ $b -le 11 ]
do
pid=`ps -aeF | grep grs_2 | grep -v "grep" | awk '{ print $2}'`
pid1=`echo $pid | awk '{ print $1}'`
pid2=`echo $pid | awk '{ print $2}'`
if [ $pid1 -ge 10 ] || [ $pid2 -ge 10 ]; then
echo "good"
else
echo "bad"
/usr/local/bin/./grs_2 -c /etc/grs_2 -b
fi
sleep 5
b=$(($b+1))

done
#reconnect ридеров
wget -c "http://127.0.0.1:18390/status.html?action=restart&label=fff&... -O - > /dev/null
wget -c "http://127.0.0.1:18390/status.html?action=restart&label=zzz&... -O - > /dev/null


Содержание

Сообщения в этом обсуждении
"Помогите! syntax error: unexpected end of file bash "
Отправлено skb7 , 10-Мрт-14 11:10 
> где поправить

Добавить в конец скрипта строку:


done


"Помогите! syntax error: unexpected end of file bash "
Отправлено vadian72 , 10-Мрт-14 20:54 
>> где поправить
> Добавить в конец скрипта строку:
>
 
> done
>

Спасибо вам теперь ок блин надо маны учить,только вот ещё вопросик последний как правильно в этом скрипте в wget авторизацию логин и пароль засунуть в целях безопасности


"Помогите! syntax error: unexpected end of file bash "
Отправлено skb7 , 10-Мрт-14 22:16 
> как правильно в этом скрипте в wget авторизацию логин и пароль
> засунуть в целях безопасности

Из мана на wget:


       --http-user=user
       --http-password=password
           Specify the username user and password password on an HTTP server.  According to the type of the challenge, Wget
           will encode them using either the "basic" (insecure), the "digest", or the Windows "NTLM" authentication scheme.

           Another way to specify username and password is in the URL itself.  Either method reveals your password to anyone
           who bothers to run "ps".  To prevent the passwords from being seen, store them in .wgetrc or .netrc, and make sure
           to protect those files from other users with "chmod".  If the passwords are really important, do not leave them
           lying in those files either---edit the files and delete them after Wget has started the download.


Если этого будет недостаточно, можно посмотреть в сторону curl.