Trigger perl

From Domoticz
Revision as of 18:55, 24 July 2017 by Philchillbill (talk | contribs) (→‎Purpose)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

This script will trigger a perl script every 1 minute as an alternative to running a cronjob. Make sure your perl script starts with a correct shebang line such as #!/usr/bin/perl

Dependencies - hardware / software / operating system

This script will work on all type of hardware / software / operating system.

It could be used to trigger any perl script such as:

Domoticz Setup - switches, variables, version

  • Replace ping_by_ip.pl by the name of your perl script
  • Make sure ping_by_ip.pl is located in : /usr/bin/ping_by_ip.pl
  • Make sure ping_by_ip.pl is executable : sudo chmod +x ping_by_ip.pl

Installation instructions

Copy this script to your domoticz\scripts\lua\ folder.

Script with comments

-- Script name : script_time_ping.lua
-- This script will trigger a perl script every 1 minute
-- Replace ping_by_ip.pl by the name of your perl script
-- Make sure ping_by_ip.pl is located in : /usr/bin/ping_by_ip.pl
-- Make sure ping_by_ip.pl is executable : sudo chmod +x ping_by_ip.pl
 
commandArray = {}

ping_success=os.execute('ping_by_ip.pl')
 
if ping_success then
print("ping success")
else
print("ping fail")
end
 
return commandArray

Example of use (if relevant) i.e. output files / screen displays

N/A