Telegram - . ? :)

FreePBX SysAdmin Pro, $25 ( 24 2018 0 .). , , , . :)


: FreePBX 13, fwconsole. , amportal 11 13 .

:

[root@asterisk ~]#touch /home/admin/log_mail.txt
[root@asterisk ~]#touch /home/admin/upgradestatus.txt

, :

#!/bin/sh
LOGSIZE=`ls -l /home/admin/log_mail.txt |  awk '{ print $5 }'` \\   - ,          
upgradable=`fwconsole ma -f showupgrades | grep Upgradable` \\ ,      
FILENAME=/home/admin/upgradestatus.txt \\   ,        ,        
LOGFILE=/home/admin/log_mail.txt \\   - 
DATE="`date +%d.%m.%Y" "%H:%M:%S`" \\,         - 
echo "$upgradable" > /home/admin/upgradestatus.txt \\          
FILESIZE=$(stat -c%s "$FILENAME") \\   ,      
if [ $FILESIZE -ne 1 ]; then \\ .     ,    .          ,  ,      
sleep 5 \\ 5 
echo `fwconsole ma upgradeall` \\      
sleep 30 \\   30 
echo `fwconsole r` \\ FreePBX
sleep 10 \\  10 
echo "OK :: $DATE :: all modules were successfully upgraded" >> "$LOGFILE" \\       ,     
else \\,       
echo "OK :: $DATE :: there is no upgradable modules" >> "$LOGFILE" \\      ,      - 
fi
if [ $LOGSIZE -ge 150000 ]; then  \\    .    150 ,    
   cat /dev/null > /home/admin/log_mail.txt
fi
cat /dev/null > /home/admin/upgradestatus.txt \\ ,          

. . .sh :


, . SFTP , , WinSCP, , SSH . , upgrade.sh /home:

[root@asteriskpbx]# dos2unix /home/upgrade.sh //     
[root@asteriskpbx]# chmod 777 /home/upgrade.sh //   

. :

[root@asterisk home]# bash -x upgrade.sh

, , :

   FreePBX 13

. cron:

[root@asteriskpbx]# crontab -e

, . , :

0 0 * * * /bin/bash /home/upgrade.sh >/dev/null

, F2, Yes Enter. ! , , , FreePBX 13 .


?