Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

[HOWTO] Manage Automatic Daily Email Reports

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
Status
Not open for further replies.

Hisma

Member
Joined
Mar 23, 2013
Messages
87
forgive me, because I am a newb.

But when the script runs at 3am, I get 2 e-mails. One with this contents -

"/etc/defaults/periodic.conf: or: not found
/etc/defaults/periodic.conf: or: not found"


The other with this contents -

"/mnt/NAS1/Scripts/daily-checks.sh: line 1: $'\r': command not found
/mnt/NAS1/Scripts/daily-checks.sh: line 3: $'\r': command not found
/mnt/NAS1/Scripts/daily-checks.sh: line 10: $'\r': command not found
/mnt/NAS1/Scripts/daily-checks.sh: line 90: syntax error: unexpected end of file"


I followed the directions to the "t" from the first post. Obviously, the crontask is working, and obviously, it's attempting to execute the script. However, I am not sure why I get these bizzare ouputs.

Can someone point me in the right direction? I can provide more info if needed...
 

Dusan

Neophyte Sage
Joined
Jan 29, 2013
Messages
1,165
"/mnt/NAS1/Scripts/daily-checks.sh: line 1: $'\r': command not found
Did you edit the files on Windows? Windows uses different line ending marker (\r\n) than Unix (\n).
 

Hisma

Member
Joined
Mar 23, 2013
Messages
87
Did you edit the files on Windows? Windows uses different line ending marker (\r\n) than Unix (\n).

haha, I sure did. It was just easier to c/p the script in windows and then copy it to my Scripts directory.

Oops. I will fix that.
 

Yatti420

Neophyte Sage
Joined
Aug 12, 2012
Messages
1,437
I noticed that Feature #2070 got closed yesterday as complete. Will this result in an option to tune verbosity of the periodic emails in the next release?

https://bugs.freenas.org/issues/2070

According to Dusan's fix..

Updated by Dusan Lacko about 1 month ago

  • Assignee changed from Dusan Lacko to William Grzybowski
I think so. The current behavior is that periodic is silent by default and only generates e-mails when something notable happens. The bug ID is #3361.
 

Durkatlon

Senior Member
Joined
Aug 19, 2011
Messages
415
OK, I just checked and my /etc/periodic.conf is indeed showing the new settings quoted in bug ID #3361. I had just turned on emails yesterday and got a set in my inbox this morning. But it looks like I made some minor modifications to other configurations that triggered the mail to be sent out. Let's see what happens tonight!
 

Yatti420

Neophyte Sage
Joined
Aug 12, 2012
Messages
1,437
OK, I just checked and my /etc/periodic.conf is indeed showing the new settings quoted in bug ID #3361. I had just turned on emails yesterday and got a set in my inbox this morning. But it looks like I made some minor modifications to other configurations that triggered the mail to be sent out. Let's see what happens tonight!

I believe if you restart your box you always get a set on day 1.. I haven't checked lately but I use to get alot of security runs from bots hammering away on ssh..
 

tanik1

Member
Joined
Mar 31, 2013
Messages
163
hi, sorry to jump and asked on this thread. But this is the only one I found with making the file system writable.

I tried to use the mount -uw / and then made some changes to the files and then mount -r / then reboot but its not saving the changes of that file. Am i doing something wrong? or that doesnt work anymore?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yes and no.

Yes because you shouldn't be playing with the FreeNAS install.

No because that's how you make changes if you are crazy enough to think you should. Additionally, many files are generated on bootup by script, so editing those files will never give the expected outcome.

FreeNAS is an appliance design. You should use it as it is intended or expect things to not necessarily go well from that point on. People have corrupted their installs and what-not because "they knew better".
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
9,039
hi, sorry to jump and asked on this thread. But this is the only one I found with making the file system writable.

I tried to use the mount -uw / and then made some changes to the files and then mount -r / then reboot but its not saving the changes of that file. Am i doing something wrong? or that doesnt work anymore?
If you have a specific thing you want to do and can't figure out how to do it, I'd open up a new thread and toss it out there to see what comes back.
 

EvanVanVan

Member
Joined
Feb 1, 2014
Messages
170
I'm having a little problem getting this setup. I thought everything went well but my emails have been screwed up the past couple nights.

The first night, I un-commented the two "OK: Daily Output[/Security] Report" lines just to see if everything was working. It wasn't. I got two emails that night, the first had a subject line of "Error: Daily Output Report" and otherwise was completely blank. The second email, with the subject "Error: Daily Security Report" had the following:
Error: Daily Security Report said:
freenas.local kernel log messages:
> CPU: Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz (3300.10-MHz K8-class CPU)
> ugen1.3: <American Power Conversion> at usbus1
> SMP: AP CPU #2 Launched!
> SMP: AP CPU #4 Launched!
> SMP: AP CPU #6 Launched!
> SMP: AP CPU #7 Launched!
> SMP: AP CPU #5 Launched!
> Timecounter "TSC-low" frequency 1650049614 Hz quality 1000

-- End of security output --
which looks more like it should be the results of the "Output" email instead of the "Security" email.

And of course, because it wasn't working properly I thought it was best (/sarcasm) to re-comment the two OK email lines. Which resulted in two blank emails with the two "Error: Daily..." subject lines.

So I un-commented the lines again to see how it turns out. The things that I did differently then the instructions was,
1. I put my daily-checks.sh file in "/mnt/volume1/scripts/daily-checks.sh".
2. When I did the 5th step the command I executed was "chown root:wheel /mnt/volume1/scripts/daily-checks.sh; chmod 660 /mnt/volume1/scripts/daily-checks.sh".
3. And just to be clear, even though the OP had some typos between "daily-check" and "daily-checks", I made everything "daily-checks" with an s.

But I've got two questions, does any know what is wrong with my emails?

Thanks

Edit: and after reading the posts at the top of the page, I want to add, I created/edited/copy+pasted the new and existing scripts using "ee" on the NAS via putty.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
9,039
I'm curious why you launched your CPU cores :rolleyes:
 

EvanVanVan

Member
Joined
Feb 1, 2014
Messages
170

EvanVanVan

Member
Joined
Feb 1, 2014
Messages
170
A few things,
1. another messed up email last night: http://forums.freenas.org/index.php?threads/whats-this-error-report-i-was-emailed.19886/#post-112037
2. The "mount -uw /" is only important for making the changes in step 3 and maybe 7 (if you don't want to reboot), right?
3. In step 3, I found this line "daily_status_security_output="root"" at line 170 instead of 163 like the instructions mention, at least in ee/nano/vi.

Edit: I'm probably going to change everything back to the defaults, and try Dusan's change one the first page.

Edit2: I realized this is probably the best advice right now anyway...
I don't have this script running yet, I haven't had 9.1.1 installed long enough to where I want to cut down the emails yet.
 

Agent Orange

Neophyte
Joined
Mar 25, 2014
Messages
11
Hi, I have just started in the world on Freenas and installed the script detailed here. I have read pages and pages on here and via user manual and cannot find the answer. When my email arrives I get "Output files(s) missing!" - so I checked the script and FTP'd to my server and cannot find the folder /var/log/ - I even tried making one to see if that would help. Have members stop using this script now ( I have read the Bug reports ) or can someone help please.

Thank's for reading this.

John

My setup:
Build FreeNAS-9.2.1.5-RELEASE-x64 (80c1d35)
Platform Intel(R) Pentium(R) CPU G2030 @ 3.00GHz
Memory 16242MB
 

warri

Neophyte Sage
Joined
Jun 6, 2011
Messages
1,193
You don't need this script in recent FreeNAS versions. They cut down on the email "spam" and there are no longer daily mails, but instead you only get an email if there is an issue (exactly like the original purpose of this script).

As for not finding /var/log, is your FTP chrooted? I'd try that via SSH, especially since you need root privileges to change something there. But again, it shouldn't be necessary in the first place!
 

Agent Orange

Neophyte
Joined
Mar 25, 2014
Messages
11
You don't need this script in recent FreeNAS versions. They cut down on the email "spam" and there are no longer daily mails, but instead you only get an email if there is an issue (exactly like the original purpose of this script).

As for not finding /var/log, is your FTP chrooted? I'd try that via SSH, especially since you need root privileges to change something there. But again, it shouldn't be necessary in the first place!

Thank you for quick reply and explanation. I will remove the script and cron job now. Still learning, so each step is at the minute slow.

Thanks again.
 

Agent Orange

Neophyte
Joined
Mar 25, 2014
Messages
11
When this morning I have received this : /etc/defaults/periodic.conf: or: not found - I have removed the script and the cron job. Any idea why I have SSH'd to server and checked and periodic.conf is there!

Thanks John
 
Status
Not open for further replies.
Top