Quantcast
Channel: FreePBX Community Forums - Latest posts
Viewing all articles
Browse latest Browse all 225809

Cdr bash script not working after migrating to freepbx distro

$
0
0

Continuing the discussion from Scheduled cdr reports with cronjob:

This stopped working after migrating from pbx in a flash. I'm getting the following error:

ERROR 1045 (28000) at line 1: Access denied for user 'freepbxuser'@'localhost' (using password: YES)

The username and password was root and passw0rd...

So I checked /etc/freepbx.conf and /etc/asterisk/cdr_mysql.conf

the username freepbx user and password as noted in those files.

However, I'm still getting the error.

#!/bin/bash
month=$(date +%m)
day=$(date +%d)
year=$(date +%y)
filename="$month$day$year"
/bin/rm -rf /tmp/results.txt&&/usr/bin/mysql -ufreepbxuser -pT00secret -D asteriskcdrdb -e "SELECT * INTO OUTFILE '/tmp/results.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM cdr WHERE calldate BETWEEN '$(date -d "$(date +%Y-%m-%d) -1 month" +%Y-%m-%d)' AND '$(date +%Y-%m-%d)'"&& cat /tmp/results.txt |sed 's/\\\"//g' > /cdrreports/cdr-$filename.csv;chown root:root /cdrreports/cdr-$filename.csv

Viewing all articles
Browse latest Browse all 225809

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>