OPNsense Forum

Archive => 16.7 Legacy Series => Topic started by: xmichielx on October 20, 2016, 11:07:47 am

Title: question about adding scripts to opnsense
Post by: xmichielx on October 20, 2016, 11:07:47 am
Hi,

I want to store a bash script on the opnsense filesystem without it get overwritten after an upgrade.
It's a script that downloads an ads block list for unbound and stores it in /var/unbound/ads.conf and reloads unbound.

My question; how do I make the script and the ads.conf file persistent on the opnsense file system so it survives an upgrade.
Title: Re: question about adding scripts to opnsense
Post by: franco on October 21, 2016, 10:24:56 am
Hi xmichielx,

Normally, no user scripts are overwritten. /var/unbound, however, is a private chroot that is likely to be reset to make its content deterministic.

Where are you storing the script now and how do you trigger it?

Are you using a Nano install?


Cheers,
Franco
Title: Re: question about adding scripts to opnsense
Post by: xmichielx on October 23, 2016, 08:58:11 pm
Hi Franco,

I am storing the script in /usr/local/bin/get-ads.sh, I ran it manually but am looking to add it to crontab.
The script creates a /var/unbound/ads.conf where all known ads servers are redirected to 127.0.0.1.
It is OK if that file is removed during an upgrade since the script/cronjob will recreate it the next day.
I am using the amd64 with serial install on an apu2.

Cheers,

Michiel