- Set up my ZoneMinder server to be an SSH server as well. (Actually, it was that anyway, because I normally manage it remotely.)
- Download SFTP client apps for my phone and my wife's phone.
- Create empty files called start and stop on both phones in a location where they can be quickly accessed through the app.
- Set up profiles to transfer those files to a specified location on the server via the SFTP app.
- Run the following script on the server. All it does is periodically check for the existence of the start or stop file, and if one exists, it will send the appropriate start or stop command to ZoneMinder and delete the file.
Code: Select all
#!/usr/bin/perl -w
#
# Checks if some files are present to automatically start or stop ZoneMinder.
#
use strict;
use warnings;
use ZoneMinder;
$| = 1;
# Interval between file checking cycles
my $timeout = 15;
# Start/stop files
my $startfile = "/home/backup/start";
my $stopfile = "/home/backup/stop";
# Delete if they exist to start
if ( fileExists( $startfile ) ) {
unlink( $startfile );
}
if ( fileExists( $stopfile ) ) {
unlink( $stopfile );
}
# Check if files exist and take appropriate action
while (1) {
if ( fileExists( $startfile ) ) {
my $runstate = runCommand( "zmdc.pl check" );
if ( $runstate ne "running" ) {
Info( "Starting ZoneMinder" );
runCommand( "zmpkg.pl start" );
}
unlink( $startfile );
}
elsif ( fileExists( $stopfile ) ) {
my $runstate = runCommand( "zmdc.pl check" );
if ( $runstate eq "running" ) {
Info( "Stopping ZoneMinder" );
runCommand( "zmpkg.pl stop" );
}
unlink( $stopfile );
}
sleep $timeout;
}
sub fileExists {
my $fname = shift;
open( my $fh, "<", $fname ) or return( 0 );
close( $fh );
return( 1 );
}
I am also open to other ideas. I know there is the zmNinja, which is probably more convenient to use on a mobile device than the website is, but I haven't tried it.It would be nice to be able to implement this solution through a bash script that can be launched with just a single click, but I don't think that's possible on my wife's iPhone without at least jailbreaking it, and we're not going to do that.