Need some help with cron jobs inside jails

Status
Not open for further replies.

ovizii

Patron
Joined
Jun 30, 2014
Messages
435
I am running gmvault inside a jail via a cron job and would like to get the output of the cronjob via email but am not sure what I need to install inside the jail for sending that email.

my crontab looks like this:
Code:
# daily sync, syncs last 7 days and cleans up emails that have been deleted on the server
0 6 * * * * /usr/local/bin/gmvault sync email@domain.tld -d /mnt/gmvaulty/ --no-compression -t quick
# monthly full sync only pulling everything down, not deleting naything
0 2 1 * * * /usr/local/bin/gmvault sync email@domain.tld -d /mnt/gmvaulty/ --no-compression  -c NO


- what do I need to install inside the jail for mail sending?
- how do I modify the cron jobs to send me the output via email?
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You can use sendmail which is already installed or find another package. See my scripts (link "Useful Scripts" in my signature) or search examples online to know how to use it ;)
 

ovizii

Patron
Joined
Jun 30, 2014
Messages
435
thanks @Bidule0hm I know your scripts and use some of them yet I fail to see the point of referring me to those as they are meant to be used from within freenas itself and not from within a jail or am I wrong?

but basically, I could install sendmail inside my jail and then setup my cron jobs to send out emails?

###edit###
just realized sendmail is installed by default inside the jails.
cron jobs seem to run fine judging by the logs
cron is supposed to send out emails by default with every cronjob so what's going wrong?

###edit2###
realized that inside the jail root just sits there so I added my email address into /etc/aliases
root: email@domain.tld
so lets see if I get any emails by tomorrow :smile:
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
I just referred to the scripts for sendmail examples as I use it in most of the scripts ;)
 

ovizii

Patron
Joined
Jun 30, 2014
Messages
435
ah, I understand, thanks.
I'd be happy with the default cron output though.

I'm learning as we speak, found out sendmail is disabled inside of jails by default, found these entries inside /etc/rc.conf - not sure which ones I need to enable besides the 2 I already did (this is getting really complicated for just sending out the output of a cron job :-(
`
sendmail_enable="YES"
sendmail_submit_enable="NO"
sendmail_outbound_enable="YES"
sendmail_msp_queue_enable="NO"
`
 

ovizii

Patron
Joined
Jun 30, 2014
Messages
435
I guess wanting to send emails from inside a jail is a stupid idea, I now get all sorts of emails from this one jail including "security run output", "daily run output", "weekly run output"...

Thanks for the help and the pointers :smile:
 
Status
Not open for further replies.
Top