Hi everyone,
i have an issue with a cron i have setup, the cron actually works fine as it is supposed to but the main problem is with rsync and the perl script that i am running.
simply, it just wont get the files from the server, acts much like a backup, except it happens every 10 minutes.
the script is failing to sync the files from one machine to the other, and i do not know why, i know the script itself works as it will run perfectly through the terminal.
cron code =
Code:
#min hour day month dow user cmd
*/10 * * * * adscreen /var/www/cgi-bin/sys/sys_stream.sh
and the script file =
Code:
#!/bin/sh
#IFS=$'\n'
streamsconfig='/var/www/data/streams.conf'
# check if the config file exists. If not then stop
[ -e $streamsconfig ] || exit
extensions=(.cfg .data .menu)
function getanims
{
/usr/bin/awk 'BEGIN {
FS="|"
}
{
if ($2 ~ /\^DU/) next
for (n=1; n<=NF; n++)
if ($n ~ /\.(swf|mov|mpg|mpeg|mp4|avi|flv|wmv|SWF|MOV|MPG|MPEG|MP4|AVI|FLV|WMV)/) print $n
}' $1
}
function getpics
{
/usr/bin/awk 'BEGIN {
FS="|"
}
{
if ($2 ~ /\^DU/) next
for (n=1; n<=NF; n++)
if ($n ~ /\.(png|jpg|gif|PNG|JPG|GIF)/) print $n
}' $1
}
conffile=(`cat $streamsconfig`)
# process each line of the config file
for line in ${conffile[@]}; do
host=`echo $line | cut -d '|' -f 2`
show=`echo $line | cut -d '|' -f 3`
# create include string for data files
include_list=""
for ext in ${extensions[@]}; do
include_list="$include_list --include=$show$ext"
done
# important to put exclude last
include_list="$include_list --exclude=*"
# retrieve the data files
rsync -uzr $include_list adscreen@$host:/var/www/data/ /var/www/data/
# create include string for anims and images
include_list="--include=anims --include=images"
for ext in ${extensions[@]}; do
for incl in `getanims /var/www/data/$show$ext | sort -u`; do
include_list="$include_list --include=anims/$incl"
done
for incl in `getpics /var/www/data/$show$ext | sort -u`; do
include_list="$include_list --include=images/$incl"
done
done
# important to put exclude last
include_list="$include_list --exclude=*"
rsync -zcr adscreen@$host:/var/www/html/$show/ /var/www/html/$show/
done
can anyone please assist me as i am new to linux stuff
i have searched high and low through forums etc with no luck as to why it wont run
Bookmarks