Difference between revisions of "Windows/DOS"
From dbawiki
(→Return the value of a function into a variable in DOS batch .bat file) |
(→Create a Scheduled Task from the command line) |
||
| Line 8: | Line 8: | ||
</pre> | </pre> | ||
===Create a Scheduled Task from the command line=== | ===Create a Scheduled Task from the command line=== | ||
| + | <pre> | ||
This one is particularly interesting as I need to start a shell Cygwin shell script on a regular basis<br /> | This one is particularly interesting as I need to start a shell Cygwin shell script on a regular basis<br /> | ||
As crontab is not implemented by default, I use the Windows Scheduler to start the jobs.<br /> | As crontab is not implemented by default, I use the Windows Scheduler to start the jobs.<br /> | ||
| Line 13: | Line 14: | ||
It is run a user different from the logged on user. The echo at the start is to answer N to the question "Task exists, do you want to replace it". For some reason that doesnt work too well :( | It is run a user different from the logged on user. The echo at the start is to answer N to the question "Task exists, do you want to replace it". For some reason that doesnt work too well :( | ||
echo N|SCHTASKS /Create /SC MINUTE /MO 10 /TN dbamon_dblist /TR "c:\cygwin\bin\bash.exe -l -c /cygdrive/c/home/ibmtools/scripts/oracle/dbamon_dblist.ksh" /ST 09:00 /RU runasuser /RP runaspwd | echo N|SCHTASKS /Create /SC MINUTE /MO 10 /TN dbamon_dblist /TR "c:\cygwin\bin\bash.exe -l -c /cygdrive/c/home/ibmtools/scripts/oracle/dbamon_dblist.ksh" /ST 09:00 /RU runasuser /RP runaspwd | ||
| + | </pre> | ||
Revision as of 13:55, 16 July 2014
Return the value of a function into a variable in DOS batch .bat file
What an awful language!
set NLS_LANG= @echo NLS_LANG has been cleared @FOR /F "usebackq delims=!" %%i IN (`sqlplus -s /nolog @set_NLS_LANG.sql`) DO @set NLS_LANG=%%i @echo NLS_LANG has been set to %NLS_LANG%
Create a Scheduled Task from the command line
This one is particularly interesting as I need to start a shell Cygwin shell script on a regular basis<br /> As crontab is not implemented by default, I use the Windows Scheduler to start the jobs.<br /> This one creates a task called dbamon_dblist tat runs a shell every 10 minutes starting at 9 am and going on for 24 hours (so, forever).<br /> It is run a user different from the logged on user. The echo at the start is to answer N to the question "Task exists, do you want to replace it". For some reason that doesnt work too well :( echo N|SCHTASKS /Create /SC MINUTE /MO 10 /TN dbamon_dblist /TR "c:\cygwin\bin\bash.exe -l -c /cygdrive/c/home/ibmtools/scripts/oracle/dbamon_dblist.ksh" /ST 09:00 /RU runasuser /RP runaspwd