Tags: agent

08/04/13

  06:03:00 pm, by The Dreamer   , 976 words  
Categories: FreeBSD, CFEngine

Wonder if this will work - package_method=>freebsd_portmaster and /var/db/pkg

On my FreeBSD system, my apache webserver would get angry whenever I update the php & extensions ports. Requiring a bunch of other operations after the 'portmaster -a'.

Since I've been playing around with CFEngine 3, I had started to add to my "bundle agent apache", to do more than just promise config files current, process running, reloads, etc.

So, one of the first problems I had run into on FreeBSD, is that there are certain extensions that need to be in order in '/usr/local/etc/php/extension.ini'. Which is solved by using fixphpextorder.sh.

Well, fortunately when this script is run it results in a backup file of 'extensions.ini.old' which is the same age or newer than 'extennsions.ini'.

CFEngine3 can take care of it this way:

Code

vars:
 
    "ext_dir"       string => "/usr/local/etc/php";
 
    "ext_file"      string => "extensions.ini";
 
    "fix_php_ext"   string => "/usr/local/etc/fixphpextorder.sh";
 
classes:
 
    "need_fix_php" expression => isnewerthan("$(ext_dir)/$(ext_file)","$(ext_dir)/$(ext_file).old");
 
commands:
 
    need_fix_php::
 
        "$(fix_php_ext)"    contain => in_dir("$(ext_dir)");
 
        "$(g.lrc_d)/$(g.apache) graceful";

g.apache is "apache22" currently on FreeBSD, and "apache2" on Ubuntu. Someday it might become "apache24" on FreeBSD.

Since I did FreeBSD first, and I'm still working on getting my one of 4 (or less) Ubuntu rolled in, I have:

g.rc_d as "/etc/rc.d" and g.lrc_d as "/usr/local/etc/rc.d" for FreeBSD. They are both set to "/etc/init.d" for Ubuntu. I also have a g.init_d for Ubuntu, but not FreeBSD. Not sure which I'll use where....I suppose if its an OS specific case, g.init_d would get used and if its not...then which ever one is the correct one for FreeBSD will get used.

Pages: 1· 2

Now instead of subjecting some poor random forum to a long rambling thought, I will try to consolidate those things into this blog where they can be more easily ignored profess to be collected thoughts from my mind.

Latest Poopli Updaters -- http://lkc.me/poop

bloglovin

There are 20 years 2 months 3 hours 53 minutes and 15 seconds until the end of time.
And, it has been 4 years 10 months 28 days 10 hours 9 minutes and 41 seconds since The Doctor saved us all from the end of the World!

Search

November 2017
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Google

Linkblog

  XML Feeds

Who's Online?

  • Guest Users: 0
This seal is issued to lawrencechen.net by StopTheHacker Inc.
open source blog tool

hosted by
Green Web Hosting! This site hosted by DreamHost.

monitored by
Monitored by eXternalTest
SiteUptime Web Site Monitoring Service
website uptime