Morisson, да, я же говорю, что скрипт из крона стартует но не отрабатывает корректно
Исходя из полученного совета от ALiEN175 полез колупать скрипты весты в поисках истины
И понимаю, что ни один из скриптов весты не читает переменную $VESTA
Попробую ее объявить в своем скрипте.
Пользователь добавил сообщение 13 Апреля 2017, 14:57:08:
И понимаю, что ни один из скриптов весты не читает переменную $VESTA
Попробую ее объявить в своем скрипте.
И таки это решило проблему!
Итоговый код
#!/bin/bash
# GIT autopull v.0.0.3-alpha
# Powered by Dmytro Barabash and shell script :)
# Many thanks for helping to:
# - Morisson (https://forum.ubuntu.ru/index.php?action=profile;u=172941)
# - renzrv (https://forum.ubuntu.ru/index.php?action=profile;u=170075)
# - ALiEN175 (https://forum.ubuntu.ru/index.php?action=profile;u=135864)
#
VESTA=/usr/local/vesta
VESTABINDIR=/usr/local/vesta/bin
TEMPDIR=/tmp/git_update
mkdir $TEMPDIR
mkdir $TEMPDIR/domainlists
mkdir $TEMPDIR/branches
echo "Start pull at `date`" >> /var/log/testing.log
#Update users list
$VESTABINDIR/v-list-users plain | awk '{print $1}' > $TEMPDIR/userbase.tmp
# Start update
for user in `cat $TEMPDIR/userbase.tmp`
do
# Creating domain lists for everyone user
$VESTABINDIR/v-list-web-domains $user plain | awk '{print $1}' > $TEMPDIR/domainlists/$user.tmp
# Learinig using git branch and do update
for domain in `cat $TEMPDIR/domainlists/$user.tmp`
do
cd /home/$user/web/$domain/public_html
mkdir $TEMPDIR/branches/$user
git branch | awk '{print $2}' > $TEMPDIR/branches/$user/$domain.tmp # For debug
git pull origin `cat $TEMPDIR/branches/$user/$domain.tmp`
chown -R $user /home/$user/web/$domain
echo "Pull done for $domain" >> /var/log/testing.log
done
done
echo "Pull done at `date`" >> /var/log/testing.log
echo "--------------------------------------------" >> /var/log/testing.log
rm -rf $TEMPDIR
Запись в кроне
# GIT Autopull
* * * * * root /bin/bash /opt/scripts/git_autopull.sh
Всем большое спасибо за помощь!