Set Up a Cron Job in MacOS

Navigation:  First steps > Install clients > XML importer >

Set Up a Cron Job in MacOS

Version 1.0.0

First create a file in the directory /usr/sbin/aagon/inventory with the following content:

#!/bin/bash

python /usr/sbin/aagon/inventory/inventory.py smbOutput=HOSTNAME.xml, %ZIELVERZEICHNIS%,%BENUTZER%,%PASSWORT%,%DOMAIN%

exit 0

 

HOSTNAME = name of the client
ZIELVERZEICHNIS = target directory XML importer
BENUTZER = user with write access for the target directory
PASSWORT = user password
DOMAIN = user domain

 

Save this file as aagon-inventory.sh. Then you must change the authorizations of the file as follows:

> chown root:wheel aagon-inventory.sh
> chmod 775 aagon-inventory.sh

 

Then create the following file in the library directory in the system root of the MAC in the LaunchDaemons directory:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
   <dict>
     <key>Label</key>
     <string>aagon.inventory</string>
     <key>Program</key>
     <string>/usr/sbin/aagon/inventory/aagon-inventory.sh</string>
     <key>RunAtLoad</key>
     <true/>
     <key>StartInterval</key>
     <integer>INTERVAL in minutes</integer>
   </dict>
</plist>

 

Save this file as aagon-inventory.plist. Then change the authorizations of the file as follows:

> chown root:wheel aagon.inventory.plist
 >  chmod  644  aagon.inventory.plist 

 

After the next reboot, the script will run as a service and scan the client at the specified interval.

Last change on 10.03.2014