Di seguito una semplice shell per verificare se un agent ODI sia o meno attivo.
#!/bin/bash
# Set the Oracle ODI Agent URL
AGENT_URL="http://localhost:25910/oraclediagent"
# Check the status of the ODI Agent
#echo "curl -so /dev/null -w "%{http_code}" $AGENT_URL"
STATUS_CODE=$(wget --server-response $AGENT_URL 2>&1 | awk '/^ HTTP/{print $2}' | grep 200 | awk '{print NR}')
echo $STATUS_CODE
# Check the HTTP status code of the ODI Agent
#if [ $STATUS_CODE == "200" ]; then
if [ $STATUS_CODE == "1" ]; then
echo "Oracle ODI Agent is running."
exit 0 # Exit with success status
else
echo "Oracle ODI Agent is not running."
exit 1 # Exit with failure status
fi
To use this script, follow these steps:
1. Open a text editor and paste the script.
2. Save the file with a `.sh` extension, for example `check_odi_agent.sh`.
3. Open a terminal and navigate to the directory where you saved the script.
4. Make the script executable with the command `chmod +x check_odi_agent.sh`.
5. Run the script with the command `./check_odi_agent.sh`.
6. The script will display whether the Oracle ODI Agent is running or not.
Nessun commento:
Posta un commento