Any way i can have a ftp script that runs for 12 hours only at specific start time?

1

Hi have this ini file that runs our encoder (Video) Can i make this config to run the ftp only at certain times? Or is there a script i can use to set the ftp to start at 7:15pm and force end at 7:30 am? Is that possible? or maybe just the script and i can schedule it on task schedule and force it to end after 12 hours. Any help would be highly appeciate it.

Thanks.

Luis.

[STATUS] STATUS=Good [TIME] REBOOT_TIME=05:08 HEARTBEAT_PERIOD=010 [CONFIG_CAMERA] CAMERA_NUMBER=4 CAMERA_1_ARCHIVE_DAYS=30 CAMERA_1_ARCHIVE_SERVICE=1 CAMERA_2_ARCHIVE_DAYS=30 CAMERA_2_ARCHIVE_SERVICE=1 CAMERA_3_ARCHIVE_DAYS=30 CAMERA_3_ARCHIVE_SERVICE=1 CAMERA_4_ARCHIVE_DAYS=30 CAMERA_4_ARCHIVE_SERVICE=1 ARCHIVE_FILE_DURATION=30

REMOTE_ARCHIVE_DISK=/mnt/DroboFS/Shares/VIDEO FTP_LOGIN=xxxx FTP_PASSWORD=xxxx [SERVERS] CMS_SERVER=www.ceverything.com CMS_DIRECTORY=nms CMS_SCRIPT=capbox_config.asp ARCHIVE_SERVER=1xx.1x.xxx.xxx

Luis Garcia

Posted 2012-07-31T17:22:48.647

Reputation: 11

Answers

0

You didn't state the OS used -- so the following just makes a good guess from the only path mentioned in your question (REMOTE_ARCHIVE_DISK=/mnt/DroboFS/Shares/VIDEO), and assumes some Linux/Unix.

To start the script at 7:15pm should be no big deal, you could use cron for this. What get's a bit trickier is to force-stop it at 7:30am -- but it is achievable in multiple ways.

  1. check the time inside your scripts loop, e.g. [ "$(date %H%M)" -gt "0730" -a "$(date %H%M)" -lt "1915" ] && exit (which will exit the script if it is later than 7:30am but earlier than 7:15pm -- the latter must be added or it would terminate right in the first loop at 7:15pm)
  2. have the sript print its PID into a file, and setup an additional cron job to read that file at 7:15pm and kill this PID

I'd say 1. would be the most clean and appropriate approach. However, this would probably not stop the script at exactly 7:15pm, but after 7:15pm when the loop encounters the check-statement the next time -- which could be considered another advantage, as a running ftp transfer would not be interrupted this way.

Both approaches would require you to wrap your FTP with a shell script. And I'm not sure about your "ini file", and whether FTP is run by your encoder software (which you didn't tell us enough about to make safe assumptions). So my answer assumes the FTP process is running separate from that other software.

Izzy

Posted 2012-07-31T17:22:48.647

Reputation: 3 187