Executing two Commands with one Crontab line

nnCron and nnCron LITE discussion

Executing two Commands with one Crontab line

Postby beginner » Wed, 28 Mar 2007, 07:25

I am trying to get a camera to start up every day at sunrise. I have a program called SUNWAIT that calculates sunrise/sunset times each day based on lat. and long. position and is useful for automation tasks. The SUNWAIT documentation lists a sample line for a crontab. I've modified it to try to run the exe file for the camera with the following:

30 04 * * * C:\Program Files\sunwait.exe sun up 44.81425N, 124.34225W ; C:\Program Files\camera.exe

I can get nnCron Lite to execute the SUNWAIT.exe by itself and it will also start the camera program by itself, but I can't get them both to execute. Researching crontab format on the internet, I see examples of ";" separating <commands>. Is there a way to get one crontab line in nnCron Lite to execute two programs.

BTW, I am a rookie and have no programing exerience. Appreciate any guidance.
beginner
 
Posts: 2
Joined: Wed, 28 Mar 2007, 06:40

Postby Valery_Kondakoff » Wed, 28 Mar 2007, 12:04

just write a simple batch file named, say, my_camera.bat and place in in the root of C drive:

Code: Select all
C:\Program Files\sunwait.exe sun up 44.81425N, 124.34225W
C:\Program Files\camera.exe


then run it like this:

Code: Select all
30 04 * * * c:\my_camera.bat


if you want camera.exe to wait until sunwait.exe is finishing its work,modify my_camera.exe.bat like this:

Code: Select all
C:\Program Files\start /wait sunwait.exe sun up 44.81425N, 124.34225W
C:\Program Files\camera.exe
CU
VK
User avatar
Valery_Kondakoff
Site Admin
 
Posts: 769
Joined: Thu, 01 Jul 2004, 20:49
Location: Moscow, Russia

Postby beginner » Sat, 31 Mar 2007, 09:34

:D
Valery, thank you very much! With a little tweeking, I got the batch file to work. Thank you for such a quick response.
beginner
 
Posts: 2
Joined: Wed, 28 Mar 2007, 06:40


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 2 guests

cron