Scheduling Cyclic Jobs in MacOSX

How to Comments Off on Scheduling Cyclic Jobs in MacOSX

Many of us UNIX old-timers are quite accustomed to cronjobs, but MacOSX has a centralized “LaunchDaemon” called launchd — to leverage it to run cronjobs gives an OS-specific, perhaps OS-preferred, method of doing so.

The TL;DR:

<?xml version=”1.0″ encoding=”UTF-8″?>

<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>

<plist version=”1.0″>

<dict>

<key>Label</key><string>com.example.rsync.SyncTheRepos</string>

<key>Program</key><string>/usr/bin/rsync</string>

<key>ProgramArguments</key>

<array>

<string>-avr</string>

<string>–delete-after</string>

<string>rsync.example.com::repos</string>

<string>~/Documents/Repos</string>

</array>

<key>EnableGlobbing</key><true/>

<key>StartCalendarInterval</key>

<dict>

<key>Hour</key><integer>3</integer>

<key>Minute</key><integer>14</integer>

</dict>

<key>ProcessType</key><string>Background</string>

</dict>

</plist>

In general, there is a lot of flexibility in setting up a launchd plist — the config info on https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html plus the various examples on the internet should help, but I generally take this example and re-use it.

Once this plist is saved as a local text file in ~/Library/LaunchAgents/ (for example, I’ll save mine as ~/Library/LaunchAgents/rsync-repos.plist), I activate it using:

launchd load -w ~/Library/LaunchAgents/rsync-repos.plist

If I want to disable the job, I use:

launchd unload -w ~/Library/LaunchAgents/rsync-repos.plist

The files are not modified in either case.

How to Convert Nicknames to JSON for VirtualWisdom4

fcfae No Comments »

VirtualWisdom4 enables a deeper insight to the metrics behind performance and available of large-scale data networks, but has a few challenges in the initial setup. One we see fairly often in the deployment side is the fact that few customers know what JSON is. Sure, a developer will say “JSON, yeah I got that”, but VirtualWisdom4 users are not all developers. Heck, our field staff don’t interpret JSON, don’t recognize when a “{” is where a “[” should be.

VirtualWisdom4 collects data as soon as it gets access, but that data is not aggregated into upper-level entities such as Hosts and Storage Arrays until those entities exist. In essence, VW4 collects immediately, but the data is of limited benefit until those entities are created, so creating those entities is critical to return-on-investment. The sooner we get to visualizing data, the sooner we can begin trouble-killing.

Often, it’s easier just to convert from a common format that our customers understand, or can produce from other tools, into JSON.

Read the rest of this entry »

Git-Backed Icinga

How to No Comments »

I want to make git commits to configure my icinga2 monitor: commit to a “devel” tree for config validation, commit to a “prod” tree to validate-and-activate a config.

[wp_graphviz simple=”yes”] devel -> { devel prod } -> check -> { prod devel “live\nicinga” } [/wp_graphviz]

 

Felipe Contreras has slowly converted me to using git.  I fight with git, but it seems the way forward based on critical mass of user-base, and only takes 7 more steps to do each thing, so my fingers get used to the additional commands.

 

I’m looking at a few tasks to get this done:

  1. init the repository
  2. load the example config shipped with icinga2 to pre-seed the “master” branch
  3. create “prod” (from “master”) and “devel” branches
  4. pre-commit hooks (both branches): run a “/etc/init.d/icinga2 configcheck” on the content
  5. post-commit hook on “prod”: export to running directory and “/etc/init.d/icinga2 configcheck”

Let’s see how this goes…

Read the rest of this entry »

Blog Engine Moved Again! Hello world!

Uncategorized No Comments »

The underlying blog engine for the blog stack was moved again… and since I used an import to sanitize the data, some things get restarted.  This isn’t as fatal as past moves, but we do get another “Hello World!” post 🙂

10 PRINT 'Hello World!'
20 GOTO 10

DCNM CIMXML CQL Notes

self-notes No Comments »

A while ago — ages, I’m certain — I refused to do a CIM_XML client for DCNM to be able to write name/pwwn pairs. It had nothing to do with us: it was a CISCO thing to a CISCO service, and didn’t even touch our application.

Then I refused again.

Then I refused again.

Finally, I figured I’d give it a look, but I cautioned heavily that there are a number of risks, and we needed a way to test.

So here we are, weeks later, lacking a method of testing. Because we’re not Cisco, and we’ve only purchased a little bit of Cisco product, Cisco isn’t delivering demo licenses — so we cannot test the CISCO thing talking to the CISCO service because we’re not Cisco. If I know how this is going to go: the PM is going to give up and invalidate many late nights of investigation and work behind “oh well, it was a cheap hack that took no time, right?” BTW: software is hard.

Memo to my future self (beside “just say ‘no'”), these tabs are where I got my information and where debugging notes can be reaped:

  • http://www.cisco.com/c/en/us/td/docs/switches/datacenter/mds9000/sw/nx-os/smi_s/programming/guide/smi_s/MOF.pdf
  • http://www.cisco.com/c/en/us/td/docs/switches/datacenter/mds9000/sw/6_x/programming/guides/smi-s/smi_s/smis_client.html#wp1157277
  • http://www.cisco.com/c/en/us/td/docs/switches/datacenter/mds9000/sw/5_2/programming/guides/smi-s/smi_s/profiles.html
  • http://sblim.sourceforge.net/cim-client2-doc/
  • http://sblim.sourceforge.net/cim-client2-v2-doc/javax/cim/CIMElement.html#getName()
  • http://sblim.sourceforge.net/cim-client2-v2-doc/org/sblim/cimclient/discovery/WBEMServiceAdvertisement.html
  • http://cvs.opengroup.org/cgi-bin/viewcvs.cgi/pegasus/src/Clients/cimcli/

In the Brocade space:

  • http://www-01.ibm.com/support/docview.wss?uid=nas7f530c1afd86f53d8862577c40012b9de
  • Really cool Brocade breakouts: https://github.com/dell-asm/dell-brocade/blob/master/lib/puppet/brocademodel.rb
  • It’s better because it’s in ruby: https://github.com/dell-asm/dell-brocade/blob/master/lib/puppet/type/brocade_alias.rb

In the LMI Space:

  • https://fedorahosted.org/openlmi/wiki/CimProviderHowto

… and a (nonworking for me) client that gives really cool toMof breakouts:

  • http://ter2011asic.googlecode.com/svn-history/r87/trunk/src/parser/wbem/ClientWbem.java

Finding and Running Java

howto 1 Comment »

As a reference, I wanted to leave a few notes as to how to find a java runtime.

If you’re on a linux system (RPM-based or Debian-based including Ubuntu flavours), BSD (including OpenBSD, NetBSD, or the MacOSX fork), or even USL Unix (including AIX flavours and the other 5999 licensees), chances are typing “java” at a prompt does something. “java -version” should spit out a version.

If you’re on Windows, then you might already have Oracle’s Java package installed; look down the various “Program Files” directories for “Oracle” or “Java”, or if search is working today, try searching for “java.exe”. Additionally, BNA and DCNM (and their variants: HPNA, CMCNE, etc) run on Java, so you might find a java.exe in a Cisco\Network Manager\jre\bin\ directory.

Either way, “java.exe -version” or “java -version” should spit out a version number.

If you don’t have a Java interpreter, then you’ll need to install one. That changes form platform to platform, but again Linux variants have it easiest, typically typing “yum install java” or “zipper install java”, or “apt-get install java”. … or some variant of that. Be aware, you might be looking for a java-1.6.0-openjdk (or for the SuSE Experience, where underscores are preferred over consistency, java-1_6_0-openjdk).

In windows, search where you normally search. If you need to go to Oracle’s website, I assume you have web access.

In either case, if you’re unable to install Java, then the type of guide I tend to write might be a bit challenging. you may need some help from your colleagues in IT.

Also, very important, javaw is for windowed apps; we do not want javaw nor javaw.exe unless we’re running a windowed application.

Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users

Uncategorized No Comments »

I keep getting this message on MacOSX 10.9.1 repeatedly:

10:42:47 Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users
10:42:47 Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users
10:42:47 Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users
10:42:48 Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users
10:42:48 Kernel: sandbox: xcscredd(141) deny file-read-metadata /Users

I found Leland Wallace‘s post on Apple’s self-help Support site, and tried the following:

*** /Applications/Server.app/Contents/ServerRoot/System/Library/Sandbox/Profiles/xcscredd.sb	2013-11-11 11:59:19.000000000 -0800
--- /Applications/Server.app/Contents/ServerRoot/System/Library/Sandbox/Profiles/xcscredd.sb	2014-02-11 11:03:50.000000000 -0800
***************
*** 62,68 ****

  ;; suppress spurious failures due to keychain notifications from xcscredhandler
  (deny file-read*
!        (subpath "/Library/Server/Xcode/Credentials/Data")   ;; we have no buisness looking in here
         (with no-log)
          )

--- 62,69 ----

  ;; suppress spurious failures due to keychain notifications from xcscredhandler
  (deny file-read*
!        (subpath "/Library/Server/Xcode/Credentials/Data")   ;; we have no business looking in here
!        (subpath "/Users")                                   ;; https://discussions.apple.com/message/23570150#23570150
         (with no-log)
          )

Let’s see if that silences a bunch of unnecessary log-noise.

Jenkins on Synology xx09 -Series

Uncategorized No Comments »

In order to get a basic CI build box going, I decided ot leverage the Synology that seems underwhelmed in what I’ve currently thrown at it.

I’d love to see a Jenkins on http://www.nslu2-linux.org/wiki/Optware/AddAPackageToOptware but for now, it’s a hack.

I followed some basic online instructions to some success:

  1. Checking What kind of CPU does my NAS have, I clearly have a MPC8533 running 64bits and 512MB
  2. per http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc I need the bootstrap http://ipkg.nslu2-linux.org/feeds/optware/syno-e500/cross/unstable/syno-e500-bootstrap_1.2-7_powerpc.xsh, which I ran from a basic root login
  3. ipkg update, ipkg search jamvm pulled in libgmp-4.3.2-1, file-5.12-1, classpath-0.98-1, zlib-1.2.5-1, and jamvm-1.5.4-1
  4. jamvm -version
    java version "1.5.0"
    JamVM version 1.5.4
    Copyright (C) 2003-2010 Robert Lougher
    
    ...
    
    Execution Engine: inline-threaded interpreter with stack-caching
    Compiled with: gcc 3.4.3 20041021 (prerelease)
    
    Boot Library Path: /opt/lib/classpath
    Boot Class Path: /opt/share/jamvm/classes.zip:/opt/share/classpath/glibj.zip
  5. http://webselblog.wordpress.com/2011/08/20/howto-setup-jenkins-on-a-synology-ds1511/ has a few typos (I hope I don’t add any!), but discusses how to hand-tool Jenkins into place:
    1. echo 'jenkins:x:145:145:Jenkins:/var/lib/jenkins:/bin/sh' >> /etc/passwd
    2. echo 'jenkins:*:10933:0:99999:7:::' >> /etc/shadow
    3. echo 'jenkins:x:145:jenkins' >> /etc/group
    4. mkdir -p /opt/jenkins/data
    5. ln -s /opt/jenkins /var/lib/jenkins
    6. check it so far: ls -al ~jenkins/data
    7. chown jenkins:jenkins /opt/jenkins/data
    8. wget -O /var/lib/jenkins/jenkins.war http://mirrors.jenkins-ci.org/war/latest/jenkins.war
    9. create the /var/lib/jenkins/jenkins_start.sh script below
    10. chmod 755 /var/lib/jenkins/jenkins_start.sh
    11. run it: /var/lib/jenkins/jenkins_start.sh
    12. check for errors in /var/lib/jenkins/data/console_log
    13. You now have a server online at your Synology server, port 8080
  6. Unfortunately, I’m stuck at:> JENKINS_HOME=/var/lib/jenkins/data /opt/bin/jamvm -XX:PermSize=512M -XX:MaxPermSize=2048M -Xmn128M -Xms1024M -Xmx2048M -jar /var/lib/jenkins/jenkins.war
    Unrecognised command line option: -Xmn128M
    ; removing that option, Segmentation fault (core dumped)
    … I think the next step is to swap in a full JVM in place of JamVM: http://www.nslu2-linux.org/wiki/DS101/JavaOnDS101G

The start/stop script look like:

su -s /bin/sh jenkins -c "
cd /var/lib/jenkins
JENKINS_HOME=/var/lib/jenkins/data exec nohup /usr/java/bin/java -jar /var/lib/jenkins/jenkins.war $JENKINS_OPTS >/var/lib/jenkins/data/console_log 2>&1 &
echo $! >/var/lib/jenkins/data/jenkins.pid"

That “JENKINS_…&” line is all one line from the “JENKINS_HOME=” to the “&” at the end. Also, if you’re cutting-and-pasting, watch out for “improved” quotation marks.

Brother MFC-J425W Scanner Buttons onto CentOS-6.4

Uncategorized No Comments »

I’m trying to get my scanner to send content to a CentOS-6.4 VM; I’m certain now it’s a case of using the buttons to trigger a request to pull content, which indeed fits the definition of what is actually happening in a modern day “push” of data (for example, MMS is really a short SMS to come and get a big payload; push-email is a notice to come and get stuff).

So. There I was. a MFC-J425W is really a brscan4 daemon, so I grabbed that:

  1. http://www.brother.com/pub/bsc/linux/dlf/brscan4-0.4.1-6.x86_64.rpm
  2. http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.4-1.x86_64.rpm

Problem is, the install %post scriptlet of brscan4 called its own /opt/brother/scanner/brscan4/setupSaneScan4 which on line 13 went looking for /etc/sane.d/dll.conf which is part of sane. Unfortunately, the notion of “dependency” escapes those brscan* RPMs, so I’ll need to add that RPM as well. sane drags in most of the state of Georgia (well, maybe just sane-frontends which pulls in libexif, libgphoto2, libieee1284, libtool-ltdl, libv4l, lockdev, sane-backends, sane-backends-libs, and sane-backends-libs-gphoto2)

A re-install of the brscan twins (yum erase, yum localinstall) doesn’t experience the same error, so I’m onto a good start.

A quick “sudo /usr/bin/brsaneconfig4 -a name=Groucho model=MFC-J425W ip=10.0.0.12” got me a registered printer under scanimage -L:

device `brother4:net1;dev0' is a Brother Groucho MFC-J425W

Success. I think ?

The next step would be a scanner-button-daemon such as scanbd; I want to use the provided Brother brscan-skey and I found that after scanimage -L found the scanner, brscan-skey can as well:

$ sudo brscan-skey -l

$ sudo brscan-skey -t
$ sudo brscan-skey
$ sudo brscan-skey -l

Groucho : brother4:net1;dev0 : 10.0.0.12 Active

That’s a fair amount of progress for the day. These are mostly notes for myself, but I hope someone else can benefit. My next step would be a customization of the brscan-skey such as per http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_scn5.html

VMWare Copied Linux Gotchas

How to, virtualization No Comments »

When I manually-clone a VM in VMWare, there are a few things I tend to have to remember. More of a memo to myself, this post will be edited or refer to later posts as necessary. I use this because I forget, and google finds my own stuff as quickly as someone else’s…

  1. Install a new VM
  2. Choose to install from another VM
  3. Choose to duplicate, not share nor steal the disk(s)
  4. Search for the Virtual Disk.vmdk file to copy (if it’s not found, is the prototype VM stopped?)
  5. wait for the install to complete
  6. edit the new MAC into the /etc/sysconfig/network-scripts/ifcfg-eth0 file
  7. check for a butchered /etc/udev/rules.d/70-persistent-net.rules file (delete the ones from the previous MAC)

From there, the new clone acts like an independent system. I usually pop into my router and hard-set the MACAddr’s name so that the DDNS gives me the IP from the hostname when the DHCP dishes out an address. That avoids the DNS delay that most people kinda forget/dont-care in PTR lookup at connection time in, oh, everything.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in