{"thread":{"id":"26866","subject":"shell script calling git fails when called from scheduler","startedAt":"2011-03-25T22:04:05Z","lastAt":"2011-03-25T23:03:33Z","messageCount":3,"participants":["Markus Heller","Matt Harrison"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"164336","messageId":"0v62r6q2lm.fsf@gmail.com","threadId":"26866","inReplyTo":null,"subject":"shell script calling git fails when called from scheduler","fromName":"Markus Heller","fromEmail":"hellerm2@gmail.com","sentAt":"2011-03-25T22:04:05Z","receivedAt":"2011-03-25T22:04:05Z","isPatch":false,"sender":{"key":"hellerm2@gmail.com","avatar":null},"body":"Hi all,\n\nI have the following batch shell script (org-git-synch.bat):\n\n@ECHO OFF\n\nREM get date and time\nfor /f \"delims=\" %%a in ('date/t') do @set mydate=%%a\nfor /f \"delims=\" %%a in ('time/t') do @set mytime=%%a\nset fvar=%mydate%%mytime%\n\nREM add all new files\ncall git add .\ncall git commit -a -m \"Automated commit by org-git-sync.bat on %fvar%\"\n\nThe script resides in h:/org/; and I have a working git repository in\nthis directory (in h:/org/.git).\n\nI can run the script from the command line no problem, but when I try to\nrun it from the Windoze scheduler, all I get is a cmd window saying:\n\nfatal: not a git repository (or any of the parent directories): .git\nfatal: not a git repository (or any of the parent directories): .git\n\nI did re-initialize the repository, but that didn't matter, since git\nstatus and everything else works fine from the command line.  I'm on Win\n7 Pro 64 bit SP 1.\n\nAny ideas?\n\nThanks and Cheers\nMarkus\n"},{"id":"164337","messageId":"20110325221914.GA11156@genestate.com","threadId":"26866","inReplyTo":"0v62r6q2lm.fsf@gmail.com","subject":"Re: shell script calling git fails when called from scheduler","fromName":"Matt Harrison","fromEmail":"iwasinnamuknow@genestate.com","sentAt":"2011-03-25T22:19:14Z","receivedAt":"2011-03-25T22:19:14Z","isPatch":false,"sender":{"key":"iwasinnamuknow@genestate.com","avatar":null},"body":"On Fri, Mar 25, 2011 at 03:04:05PM -0700, Markus Heller wrote:\n> Hi all,\n> \n> I have the following batch shell script (org-git-synch.bat):\n> \n> @ECHO OFF\n> \n> REM get date and time\n> for /f \"delims=\" %%a in ('date/t') do @set mydate=%%a\n> for /f \"delims=\" %%a in ('time/t') do @set mytime=%%a\n> set fvar=%mydate%%mytime%\n> \n> REM add all new files\n> call git add .\n> call git commit -a -m \"Automated commit by org-git-sync.bat on %fvar%\"\n> \n> The script resides in h:/org/; and I have a working git repository in\n> this directory (in h:/org/.git).\n> \n> I can run the script from the command line no problem, but when I try to\n> run it from the Windoze scheduler, all I get is a cmd window saying:\n> \n> fatal: not a git repository (or any of the parent directories): .git\n> fatal: not a git repository (or any of the parent directories): .git\n> \n> I did re-initialize the repository, but that didn't matter, since git\n> status and everything else works fine from the command line.  I'm on Win\n> 7 Pro 64 bit SP 1.\n> \n> Any ideas?\n> \n> Thanks and Cheers\n> Markus\n\nAt a guess (I dont use the windows scheduler), the working directory of the batch file\nis not being set to h:/org\n\nI dont know if there is a way to tell the windows scheduler what the working directory\nshould be, so maybe try cd'ing to h:/org at the start of your script?\n\nHTH\n\nMatt\n"},{"id":"164339","messageId":"0v1v1upzui.fsf@gmail.com","threadId":"26866","inReplyTo":"20110325221914.GA11156@genestate.com","subject":"Re: shell script calling git fails when called from scheduler","fromName":"Markus Heller","fromEmail":"hellerm2@gmail.com","sentAt":"2011-03-25T23:03:33Z","receivedAt":"2011-03-25T23:03:33Z","isPatch":false,"sender":{"key":"hellerm2@gmail.com","avatar":null},"body":"Matt Harrison <iwasinnamuknow@genestate.com> writes:\n\n> On Fri, Mar 25, 2011 at 03:04:05PM -0700, Markus Heller wrote:\n>> Hi all,\n>> \n>> I have the following batch shell script (org-git-synch.bat):\n>> \n>> @ECHO OFF\n>> \n>> REM get date and time\n>> for /f \"delims=\" %%a in ('date/t') do @set mydate=%%a\n>> for /f \"delims=\" %%a in ('time/t') do @set mytime=%%a\n>> set fvar=%mydate%%mytime%\n>> \n>> REM add all new files\n>> call git add .\n>> call git commit -a -m \"Automated commit by org-git-sync.bat on %fvar%\"\n>> \n>> The script resides in h:/org/; and I have a working git repository in\n>> this directory (in h:/org/.git).\n>> \n>> I can run the script from the command line no problem, but when I try to\n>> run it from the Windoze scheduler, all I get is a cmd window saying:\n>> \n>> fatal: not a git repository (or any of the parent directories): .git\n>> fatal: not a git repository (or any of the parent directories): .git\n>> \n>> I did re-initialize the repository, but that didn't matter, since git\n>> status and everything else works fine from the command line.  I'm on Win\n>> 7 Pro 64 bit SP 1.\n>> \n>> Any ideas?\n>> \n>> Thanks and Cheers\n>> Markus\n>\n> At a guess (I dont use the windows scheduler), the working directory of the batch file\n> is not being set to h:/org\n>\n> I dont know if there is a way to tell the windows scheduler what the working directory\n> should be, so maybe try cd'ing to h:/org at the start of your script?\n\nThanks Matt,\n\nthis was the problem.  U can specify the directory where the script\nshould be run in the scheduler.\n\nCheers\nMarkus\n"}]}