Set Up a Cron Job with Linux

Navigation:  First steps > Install clients > XML importer >

Set Up a Cron Job with Linux

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
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

 

In a next step, execute the following command with root rights:

> crontab –l > /usr/sbin/aagon/inventory/cron.txt

 

Then add the following line at the end of the file cron.txt:

0 10 * * 1 /usr/sbin/python /usr/sbin/aagon/inventory/aagon-inventory.sh

 

In this way, the client is scanned every Monday at 10:00 clock. The interval can be defined as desired. This setting is only as a recommendation. Finally, execute the following command with root rights:

> crontab cron.txt

 

The script is now running as a cron job and scans the client at the specified interval.

Last change on 10.03.2014